public async Task <IActionResult> AddRating() { var newRatingValidator = new NewRatingValidator(); var id = int.Parse(Request.Form["id"]); var validateResult = await newRatingValidator.ValidateAsync(Request.Form["newRating"]); var result = FilmDetailsVm.Map(await _filmsService.GetFIlmDetails(id)); if (!validateResult.IsValid) { foreach (var error in validateResult.Errors) { result.NewRatingErrors.Add(error.ErrorMessage); } return(View("Details", result)); } await _filmsService.AddNewRating(id, int.Parse(Request.Form["newRating"])); result.Ratings.Add(int.Parse(Request.Form["newRating"])); return(View("Details", result)); }
public async Task <IActionResult> Details(int id) { var result = FilmDetailsVm.Map(await _filmsService.GetFIlmDetails(id)); return(View(result)); }