Ejemplo n.º 1
0
        public ActionResult CreateEdit(CreateEditGenre item)
        {
            var genreFormValidator = new GenreFormValidator();

            if (!genreFormValidator.Validate(item.Form))
            {
                foreach (var e in genreFormValidator.Exceptions)
                {
                    ModelState.AddModelError(e.Property, e.Message);
                }
                return(View(genreService.GetGenre(item.Form.Id)));
            }
            else
            {
                genreService.CreateEditGenre(item.Form);
                return(RedirectToAction("Index"));
            }
        }