List <SelectListItem> GetCategorieItems() { List <SelectListItem> ProposedReturnValue = new List <SelectListItem>(); using (ContextBll ctx = new ContextBll()) { List <CategorieBLL> roles = ctx.GetCategorie(0, 25); foreach (CategorieBLL r in roles) { SelectListItem i = new SelectListItem(); i.Value = r.CategorieID.ToString(); i.Text = r.Categorie; ProposedReturnValue.Add(i); } } return(ProposedReturnValue); }
public ActionResult Page(int PageNumber, int PageSize) { ViewBag.PageNumber = PageNumber; ViewBag.PageSize = PageSize; List <CategorieBLL> Model = new List <CategorieBLL>(); try { using (ContextBll ctx = new ContextBll()) { ViewBag.TotalCount = ctx.ObtainCategoriCount(); Model = ctx.GetCategorie(PageNumber * PageSize, PageSize); } return(View("Index", Model)); } catch (Exception ex) { ViewBag.Exception = ex; return(View("Error")); } }