コード例 #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);
 }