public static void Show(ListBox lb, Mahsolat_Type type) { try { lb.DataTextField = "Name"; lb.DataValueField = "MahsolatID"; using (FruitShopEntity db = new FruitShopEntity()) { var list = db.Mahsolats.Where(x => x.Type == type) .Select(x => new { x.MahsolatID, x.Name, }) .ToList(); lb.DataSource = list; } lb.DataBind(); } catch (Exception) { } }
public static void Show(Repeater rp, Mahsolat_Type type) { try { using (FruitShopEntity db = new FruitShopEntity()) { var list = db.Mahsolats.Where(x => x.Type == type) .OrderByDescending(x => x.MahsolatID) .ToList(); rp.DataSource = list; } rp.DataBind(); } catch (Exception) { } }
public static List <Mahsolat> Get(Mahsolat_Type type, int pageIndex = 1, int pageSize = 4) { try { using (FruitShopEntity db = new FruitShopEntity()) { return(db.Mahsolats.Where(x => x.Type == type) .Distinct() .OrderByDescending(x => x.MahsolatID) .Skip(pageSize * (pageIndex - 1)) .Take(pageSize) .ToList()); } } catch (Exception) { return(new List <Mahsolat>()); } }
public static void Show(GridView gv, Mahsolat_Type type) { try { string[] t = new string[1]; t[0] = "MahsolatID"; gv.DataKeyNames = t; using (FruitShopEntity db = new FruitShopEntity()) { var list = db.Mahsolats.Where(x => x.Type == type) .OrderByDescending(x => x.MahsolatID) .ToList(); gv.DataSource = list; } gv.DataBind(); } catch (Exception ee) { } }