public string GetAllBasicData() { Cuponera.Backend.Controllers.categoryController cb = new Backend.Controllers.categoryController(); IEnumerable <category> categories = cb.Getcategory(false).OrderBy(c => c.Name); return(Helpers.JSONHelper.SerializeJSON(categories.ToList().Select(category => new { id = category.IdCategory, name = category.Name }))); }
public async Task <ActionResult> Activate(int id) { Cuponera.Backend.Controllers.categoryController cb = new Backend.Controllers.categoryController(); await cb.Activate(id); return(new HttpStatusCodeResult(HttpStatusCode.OK)); }
private IEnumerable <category> get(bool all, string name, int pageNumber) { Cuponera.Backend.Controllers.categoryController cb = new Backend.Controllers.categoryController(); IEnumerable <category> companies = cb.Getcategory(all, name); int pageSize = Convert.ToInt32(ConfigurationManager.AppSettings["ElementsPerPage"]); ViewBag.Pages = Convert.ToInt32(Math.Ceiling((double)companies.Count() / pageSize)); int elemsToSkip = pageSize * (pageNumber - 1); return(companies.Skip(elemsToSkip).Take(pageSize)); }