Beispiel #1
0
        // GET: Admin/Categories
        public async Task <ActionResult> Index()
        {
            if (Session["iduserAdmin"] == null)
            {
                return(RedirectToAction("Login", "HomeAdmin", new { area = "Admin" }));
            }
            var category = await _category.GetAllAsync();

            return(View(category));
        }
        public async Task <ActionResult> CategoryView()
        {
            if (Session["Account"] == null || (Session["Account"] as Account).Role == RoleUser.Customer)
            {
                return(Redirect("/"));
            }
            var categories = await _category.GetAllAsync();

            return(View("~/Areas/Admin/Views/CategoryAdmin/CategoryView.cshtml", categories));
        }
        public async Task <ActionResult> ProductModal(int productId)
        {
            var categories = await _category.GetAllAsync();

            ViewBag.CategoryList = new SelectList(categories, "CategoryId", "Name");

            var publishers = await _publisher.GetAllAsync();

            ViewBag.PubliserList = new SelectList(publishers, "PublisherId", "Name");

            ViewBag.Label = "Thêm";

            Product product = new Product();

            if (productId > 0)
            {
                ViewBag.Label = "Cập nhật";
                product       = await _product.FindAsync(x => x.ProductId == productId);
            }
            return(PartialView("~/Areas/Admin/Views/ProductAdmin/_ProductModal.cshtml", product));
        }
Beispiel #4
0
        public async Task <IActionResult> GetAllAsync()
        {
            var categories = await _categoryServices.GetAllAsync();

            return(Ok(categories));
        }
Beispiel #5
0
 // GET: Admin/Categories
 public async Task <ActionResult> Index()
 {
     return(View(await _category.GetAllAsync()));
 }