public ActionResult SerialInfo(int?id, string message) { try { var user = GetUser(); var serial = serialService.GetSerial(id); var serialWatchedEp = userService.WatchedEp(user, serial); ViewBag.staredItems = userService.GetRateUser(user, serial); ViewBag.Watched = userService.CheckSerial(user, serial); if (message != null) { ViewBag.StatusMessage = message; } else { ViewBag.StatusMessage = ""; } return(View(serialWatchedEp)); } catch { return(RedirectToAction("HttpNotFound", "Error")); } }
public IActionResult EditSerial(int id) { var serial = _serialService.GetSerial(id); var serialGenres = _serialService.GetNamesOfGenres(id); var genres = _genreService.GetAllGenres(); var serialModel = new SerialEditViewModel() { SerialId = serial.Id, Name = serial.Name, SelectedCountryId = serial.CountryId, Countries = _countryService.GetAllCountries().Select(c => new Select() { Name = c.Name, Id = c.Id }).ToList(), GenreOptions = genres.Select(g => new Option() { Name = g.Name, IsSelected = serialGenres.Contains(g.Name) }).ToList() }; return(View(serialModel)); }
public IActionResult GetById(int id) { var serial = serialService.GetSerial(id); return(Ok()); }