示例#1
0
        public async Task <ActionResult> Create(BrandVM model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            OperationResult result = await _brandManager.CreateAsync(model.Name);

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

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

            return(View(model));
        }