Exemplo n.º 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 });
        }
Exemplo n.º 2
0
        public ActionResult DeleteSingle(CategoryModel model)
        {
            _categoryService.DeleteCategory(model.CategoryId);
            _categoryService.SaveCategory();
            HttpContext.Application.Remove("categories");

            return RedirectToAction("Index");
        }
Exemplo n.º 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") });
        }
Exemplo n.º 4
0
 public ActionResult DeleteError(CategoryModel model)
 {
     return RedirectToAction("DeleteError", model);
 }