public ActionResult Edit(int id) { GenreSinglePageViewModel model = new GenreSinglePageViewModel(); model.GenreViewModel = _genreService.GetGenreById(id).ConvertToViewModel(); return(View(model)); }
public ActionResult Create() { GenreSinglePageViewModel model = new GenreSinglePageViewModel(); model.GenreViewModel = new GenreViewModel(); model.Success = true; return(View(model)); }
public ActionResult Edit(GenreSinglePageViewModel model) { if (ModelState.IsValid) { _genreService.UpdateGenre(model.GenreViewModel.ConvertToModel()); return(RedirectToAction("Index")); } return(View(model)); }
public ActionResult Create(GenreSinglePageViewModel model) { CreateGenreRequest request = model.GenreViewModel.ConvertToCreateGenreRequest(); CreateGenreResponse response = _genreService.CreateGenre(request); if (response.Success) { return(RedirectToAction("Index")); } else { model.Success = false; model.Message = response.Message; return(View(model)); } }
public ActionResult Details(int id) { GenreSinglePageViewModel model = new GenreSinglePageViewModel(); FindAllGenresResponse response = _genreService.FindAllGenres(); if (response.Success) { model.GenreViewModel = response.Genres.Where(x => x.GenreId == id).First().ConvertToGenreViewModel(); model.Success = true; } else { model.Message = response.Message; model.Success = false; } return(View(model)); }