public ActionResult Create(CreateGenreViewModel model) { if (!ModelState.IsValid) { return View(model); } var request = new CreateGenreRequest { Name = model.Name, Description = model.Description }; _genreService.CreateGenre(request); return RedirectToAction("Index"); }
public CreateGenreResponse CreateGenre(CreateGenreRequest request) { var response = new CreateGenreResponse(); var genre = new Genre { Name = request.Name, Description = request.Description }; ThrowExceptionIfGenreIsInvalid(genre); _genreRepository.Add(genre); _uow.Commit(); MvcSiteMapProvider.SiteMaps.ReleaseSiteMap(); response.Genre = genre.ConvertToGenreView(); return response; }