Exemplo n.º 1
0
        public async Task <ActionResult> Edit(BrandVM model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            OperationResult result = await _brandManager.Edit(new BrandDTO
            {
                Id   = model.Id,
                Name = model.Name
            });

            if (result.Type == ResultType.Success)
            {
                //_toast.AddSuccessToastMessage("Brand has been successfully edited");
                //return View(model);
                return(RedirectToAction(nameof(List)));
            }

            ModelState.AddModelError(nameof(model.Name), result.BuildMessage());

            return(View(model));
        }