public async static Task <List <Categories> > GetCategories(IConfiguration _configuration) { ServiceCategories serviceCategory = new ServiceCategories(_configuration); List <Categories> categoryList = await serviceCategory.GetCategories(); categoryList.Insert(0, new Categories { CategoryName = "" }); return(categoryList); }
// GET: CategoryViews public ActionResult Index() { List <CategoryDM> categoriesDM = serviceCategories.GetCategories().ToList(); List <CategoryView> categories = new List <CategoryView>(); foreach (var c in categoriesDM) { categories.Add(new CategoryView(c)); } return(View(categories)); }
// GET: Categories public async Task<IActionResult> Index(int page = 1, int itemsPerPage = 10) { DistributionPerPage distributionPerPage = new DistributionPerPage(); distributionPerPage.recordCount = await _serviceCategories.GetCount(); distributionPerPage.itemsPerPage = itemsPerPage; distributionPerPage.page = page; distributionPerPage.CalculateDistribution(); ViewData["PagesCount"] = int.Parse(distributionPerPage.pageCount.ToString()); ViewData["page"] = distributionPerPage.page; ViewData["PageStart"] = distributionPerPage.PageStart; ViewData["PagingItems"] = distributionPerPage.itemsPerPage; ViewData["ControllerName"] = "Categories"; var _results = await _serviceCategories.GetCategories(page, itemsPerPage); return View(_results); }
// GET: ProductViews/Create public ActionResult Create() { ProductEdit productEdit = new ProductEdit(serviceCategories.GetCategories()); return(View(productEdit)); }