예제 #1
0
        // 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));
        }
예제 #3
0
        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));
            }
        }
예제 #4
0
 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))));
 }