예제 #1
0
        public JsonResult Create(CategoryModel model)
        {
            if (ModelState.IsValid)
            {
                var category = Mapper.Map<CategoryModel, Category>(model);

                _categoryService.CreateCategory(category);
                _categoryService.SaveCategory();
                HttpContext.Application.Remove("categories");

                return Json(new { url = Url.Action("Index", "Category") });
            }
            return Json(new { Success = false });
        }
예제 #2
0
        public ActionResult DeleteSingle(CategoryModel model)
        {
            _categoryService.DeleteCategory(model.CategoryId);
            _categoryService.SaveCategory();
            HttpContext.Application.Remove("categories");

            return RedirectToAction("Index");
        }
예제 #3
0
        public JsonResult UpdateCategory(CategoryModel model)
        {
            var category = Mapper.Map<CategoryModel, Category>(model);
            _categoryService.EditCategory(category);
            _categoryService.SaveCategory();
            HttpContext.Application.Remove("categories");

            return Json(new { url = Url.Action("Index", "Category") });
        }
예제 #4
0
 public ActionResult DeleteError(CategoryModel model)
 {
     return RedirectToAction("DeleteError", model);
 }