// GET: Category public ActionResult Index() { if (!isAuthenticated()) { return(RedirectToAction("Index", "Auth")); } var categories = _categoryBll.Get(); return(View(categories)); }
public IActionResult UpdateCategory(int id) { Category category = categoryBLL.Get(id).Data; CategoryVM categoryVM = new CategoryVM { CategoryName = category.CategoryName, Overview = category.Description }; return(View(categoryVM)); }
public IActionResult GetCategorByID(int id) { try { Category category = categoryBLL.Get(id).Data; CategoryDTO categoryDTO = new CategoryDTO() { CategoryID = category.ID, CategoryName = category.CategoryName }; return(Ok(categoryDTO)); } catch (Exception ex) { return(NotFound(ex.Message)); } }
public async Task <IActionResult> Index(int page = 1) { ViewBag.currentPage = page; ViewBag.totalPage = TotalPage(CategoryBLL.Cout()); return(View(await CategoryBLL.Get(numberPerPage, page, orderBy: p => p.OrderByDescending(x => x.EditedDate)))); }