Example #1
0
        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);
        }
Example #2
0
        // 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);
		}
Example #4
0
        // GET: ProductViews/Create
        public ActionResult Create()
        {
            ProductEdit productEdit = new ProductEdit(serviceCategories.GetCategories());

            return(View(productEdit));
        }