예제 #1
0
        public ActionResult DeleteCategory(CategoryItemViewModel category)
        {
            bool success = GetCommand<DeleteCategoryCommand>().ExecuteCommand(
                new DeleteCategoryCommandRequest
                    {
                        CategoryId = category.Id,
                        Version = category.Version
                    });

            if (success)
            {
                Messages.AddSuccess(PagesGlobalization.DeleteCategory_DeletedSuccessfully_Message);
            }

            return Json(new WireJson(success));
        }
예제 #2
0
        public ActionResult SaveCategory(CategoryItemViewModel category)
        {
            if (ModelState.IsValid)
            {
                var response = GetCommand<SaveCategoryCommand>().ExecuteCommand(category);
                if (response != null)
                {
                    if (category.Id.HasDefaultValue())
                    {
                        Messages.AddSuccess(PagesGlobalization.CreateCategory_CreatedSuccessfully_Message);
                    }
                    return Json(new WireJson { Success = true, Data = response });
                }
            }

            return Json(new WireJson { Success = false });
        }