예제 #1
0
        public async Task <IActionResult> CreateColor(Color color)
        {
            if (!ModelState.IsValid)
            {
                return(RedirectToAction(nameof(Index), color));
            }

            IResult result = await _colorService.AddOrEditAsync(color);

            if (!result.IsSuccess)
            {
                ModelState.AddModelError("CreateError", result.Message);
                return(RedirectToAction(nameof(Index), color));
            }

            return(RedirectToAction("Index", "Color"));
        }