Exemple #1
0
        public async Task <IActionResult> CreateBrand(Brand brand)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction("Index", brand));
            }

            IResult result = await _brandService.AddOrEditAsync(brand);

            if (!result.IsSuccess)
            {
                ModelState.AddModelError("CreateError", result.Message);
                return(View("Index", brand));
            }
            return(RedirectToAction("Index", "Brand"));
        }