Exemplo n.º 1
0
        public ActionResult Edit(Guid id, CategoryViewModel vm)
        {
            if (!ModelState.IsValid)
            {
                this.AddToastMessage("", "Error while editing Category.", ToastType.Error);
                return(View("Edit", vm));
            }

            var result = _categoryApplication.Update(vm, id);


            if (result)
            {
                this.AddToastMessage("", "Category edited with success.", ToastType.Success);
                return(RedirectToAction("Index"));
            }
            else
            {
                this.AddToastMessage("", "Error while editing Category.", ToastType.Error);
                return(View("Edit", vm));
            }
        }