public void Refresh() { Repertoires.Clear(); var location = _appSettings.Location; if (location != null) { var cinemas = Task.Run(() => _dataStorage.GetCinemaRepertoires(location)).Result; foreach (var cinema in cinemas) { var color = CinemaHelper.TextColor((CinemaType)cinema.CinemaType); var displayName = String.Format("{0} {1}", cinema.CinemaName, cinema.CinemaCity); var shortName = String.Format("{0}{1}", cinema.CinemaName.Substring(0, 2), cinema.CinemaCity.Substring(0, 1)); var group = new Group <MovieShows>(color, displayName, shortName); foreach (var movie in cinema.Movies) { if (_filter.Check(movie)) { var movieShow = new MovieShows(cinema.Id, movie.Id, group.DisplayName, movie.Title, movie.Genres, movie.Shows, movie.Rating); group.Add(movieShow); } } Repertoires.Add(group); } } }
public ActionResult AddSession(AddSessionModel model) { repo.AddSessionsPack(new Film(model.FilmName, int.Parse(model.FilmYear), CinemaHelper.ConvertStringToGenre(model.FilmGenre), int.Parse(model.FilmYear), int.Parse(model.FilmLenghtInMinutes), model.FilmCountry), new Session(Guid.NewGuid(), int.Parse(model.SessionHall), int.Parse(model.SessionPrice), Convert.ToDateTime(model.SessionTime), Status.InStock, 1), new Hall(int.Parse(model.SessionHall))); return(RedirectToAction("Index", "Admin")); }