Exemplo n.º 1
0
        public static IEnumerable <SelectListItem> GetFactionItems(this HtmlHelper html, int factionID, Expression <Func <Faction, bool> > filter = null)
        {
            var ret = new ZkDataContext().Factions.AsQueryable().Where(x => !x.IsDeleted);

            if (filter != null)
            {
                ret = ret.Where(filter);
            }
            return(ret.Select(x => new SelectListItem {
                Text = x.Name, Value = x.FactionID.ToString(), Selected = x.FactionID == factionID
            }));
        }