using System.Collections.Generic; using System.Linq; using System.Web.Mvc; using FHT.Agency.CommonTypes; using FHT.Utilities; namespace FHT.Agency.Web.Common { public class FeatureHelp { private static readonly List _excludedSingleSellFeatureTypes = new List() { FeatureType.SEO }; private static readonly List _excludedPackageFeatureTypes = new List() { FeatureType.Advertisement, }; public static List GetExcludedSingleSellFeatureTypes() { return _excludedSingleSellFeatureTypes; } public static List GetExcludedPackageFeatureTypes() { return _excludedPackageFeatureTypes; } public static IEnumerable GetSingleSellFeatureTypes(FeatureType? selectedFeatureType) { return EnumHelpers.GetObjectsFromEnum(typeof(FeatureType)) .Where(u => !_excludedSingleSellFeatureTypes.Contains((FeatureType)u.Value)) .OrderBy(m => m.Value) .Select(s => new SelectListItem { Value = s.Value.ToString(), Text = s.Name, Selected = selectedFeatureType.HasValue && (FeatureType)s.Value == selectedFeatureType.Value }); } public static IEnumerable GetPackageFeatureTypes(FeatureType? selectedFeatureType) { return EnumHelpers.GetObjectsFromEnum(typeof(FeatureType)) .Where(u => !_excludedPackageFeatureTypes.Contains((FeatureType)u.Value)) .OrderBy(m => m.Value) .Select(s => new SelectListItem { Value = s.Value.ToString(), Text = s.Name, Selected = selectedFeatureType.HasValue && (FeatureType)s.Value == selectedFeatureType.Value }); } } }