Esempio n. 1
0
        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 })));
        }
Esempio n. 2
0
        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));
        }