// GET: Find public ActionResult Index(string SearchString, DateTime?ScreeningStart, DateTime?ScreeningEnd, DateTime?ReleaseStart, DateTime?ReleaseEnd, int?SelectedGenreID = 0) { var context = new KinoContext(); var queryResults = (from mov in context.Movies join screen in context.Screenings on mov.ID equals screen.MovieId //Select movies_screens where SearchString == null | mov.Title.Contains(SearchString) // Searchstring ==null -> match all if string not inputted where (ScreeningStart == null | ScreeningStart <= screen.ScreeningStart) & (ScreeningEnd == null | screen.ScreeningStart <= ScreeningEnd) // Where screeningStart is in selected period where (ReleaseStart == null | ReleaseStart <= mov.ReleaseDate) & (ReleaseEnd == null | mov.ReleaseDate <= ReleaseEnd) // Where Release is in selected period where SelectedGenreID == 0 | SelectedGenreID == mov.Genre.ID select new UpcomingScreening { Title = mov.Title, genre = mov.Genre.Name, Image = mov.Files.FirstOrDefault().Content, language = screen.Language, subtitleLanguage = screen.SubtitleLanguage, Description = mov.Description, length = ((screen.ScreeningEnd.Value.Hour - screen.ScreeningStart.Value.Hour) * 60) + (screen.ScreeningEnd.Value.Minute - screen.ScreeningStart.Value.Minute), youtube_link = mov.YouTubeLink, startTime = screen.ScreeningStart.Value, venue = screen.Venue.Name, isPremiere = (bool)screen.IsPremiere, rating = mov.Rating }).ToList(); var viewModel = new UpcomingScreeningsViewModel(); viewModel.ScreeningItems = queryResults; ViewBag.SelectedGenreId = new SelectList(context.Genres, "ID", "Name", SelectedGenreID); return(View(viewModel)); }
//Makes a List with the Kino comments from the Database public List <Kino> GetAll() { using (context = new KinoContext()) { return(context.KinoComments.ToList()); } }
public ActionResult Index() { var context = new KinoContext(); var queryResults = (from mov in context.Movies join screen in context.Screenings on mov.ID equals screen.MovieId where (screen.ScreeningStart.Value.Year == System.DateTime.Now.Year & screen.ScreeningStart.Value.Month == System.DateTime.Now.Month) select new UpcomingScreening { Title = mov.Title, genre = mov.Genre.Name, Image = mov.Files.FirstOrDefault().Content, language = screen.Language, subtitleLanguage = screen.SubtitleLanguage, Description = mov.Description, length = ((screen.ScreeningEnd.Value.Hour - screen.ScreeningStart.Value.Hour) * 60) + (screen.ScreeningEnd.Value.Minute - screen.ScreeningStart.Value.Minute), youtube_link = mov.YouTubeLink, startTime = screen.ScreeningStart.Value, venue = screen.Venue.Name, isPremiere = (bool)screen.IsPremiere, rating = mov.Rating }).ToList(); var viewModel = new UpcomingScreeningsViewModel(); viewModel.ScreeningItems = queryResults; return(View(viewModel)); }
public void RefreshBookings() { using (KinoContext db = new KinoContext()) { allbookings = new List <Booking>(); var bookingsdb = db.ReservationCodes; var bookingsids = new List <int>(); foreach (var x in bookingsdb) { bookingsids.Add(x.Id); } foreach (var x in bookingsids) { List <Place> currplaces = new List <Place>(); ReservationCode curr = db.ReservationCodes.First(r => r.Id == x); FilmsDatesSeances fds = db.FilmsDatesSeances.First(f => f.Id == curr.FilmDateSeanceId); FilmsDates fd = db.FilmsDates.First(f => f.Id == fds.FilmsDatesId); Seance s = db.Seances.First(f => f.Id == fds.SeanceId); Film film = db.Films.First(fi => fi.Id == fd.FilmId); Date date = db.Dates.First(da => da.Id == fd.DateId); var placesdb = db.ReservationPlaces.Where(pl => pl.CodeId == x); foreach (var place in placesdb) { Place temp = new Place { Range = place.Range, Seat = place.Place, Retiree = place.Retiree, Student = place.Student }; if (place.Student) { temp.Price = place.Price + " (студент)"; } else if (place.Retiree) { temp.Price = place.Price + " (пенсионер)"; } else { temp.Price = place.Price.ToString(); } currplaces.Add(temp); } allbookings.Add(new Booking { UserId = (int)curr.UserId, Code = curr.Code, User = db.Users.First(u => u.Id == curr.UserId).FirstName + " " + db.Users.First(u => u.Id == curr.UserId).LastName, Date = date.Title.ToString("d"), Film = film.Name, Time = s.Title.ToString("t"), places = currplaces, TotalCost = curr.TotalPrice, FDS = fds.Id }); } } if (user == null) { notifications.Visibility = Visibility.Collapsed; } }
public AuthController(SignInManager <User> signInManager, UserManager <User> userManager, KinoContext context, IEncoder encoder, JwtTokenGenerator tokenGenerator) { this.signInManager = signInManager; this.userManager = userManager; this.context = context; this.encoder = encoder; this.tokenGenerator = tokenGenerator; }
public ActionResult Kino(Kino kinoModel) { using (KinoContext context = new KinoContext()) { context.KinoComments.Add(kinoModel); context.SaveChanges(); } return(View("Kino", new Kino())); }
public void RefreshUserInfo() { try { using (KinoContext db = new KinoContext()) { user = db.Users.First(x => x.Id == user.Id); } } catch { } }
public static KinoContext GetDbContext() { var internalServiceProviderForDbContext = new ServiceCollection() .AddEntityFrameworkInMemoryDatabase() .BuildServiceProvider(); var options = new DbContextOptionsBuilder <KinoContext>() .UseInternalServiceProvider(internalServiceProviderForDbContext) .UseInMemoryDatabase("KinoContext_UnitTesting" + new Guid().ToString()) .Options; var dbContext = new KinoContext(options); dbContext.Database.EnsureDeleted(); dbContext.Database.EnsureCreated(); return(dbContext); }
private void ButtonFechar_Click(object sender, RoutedEventArgs e) { using (KinoContext db = new KinoContext()) { db.Subscriptions.RemoveRange(db.Subscriptions); db.SaveChanges(); foreach (var x in allfilms.ToList()) { var subs = x.Subscribers; foreach (User s in subs.ToList()) { db.Subscriptions.Add(new Subscription { UserId = s.Id, FilmId = x.Id }); db.SaveChanges(); } } } Application.Current.Shutdown(); }
public GenreMovieController(KinoContext context) { _context = context; }
public BiletyRepository(KinoContext context) : base(context) { _context = context; }
public UserController(UserManager <User> userManager, KinoContext context, IEncoder encoder) { this.userManager = userManager; this.context = context; this.encoder = encoder; }
public KlienciRepository(KinoContext context) : base(context) { _context = context; }
public FilmoviService(KinoContext context, IMapper mapper) : base(context, mapper) { _context = context; _mapper = mapper; }
public OpinieRepository(KinoContext context) : base(context) { _context = context; }
public KorisniciService(KinoContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public SeanseRepository(KinoContext context) : base(context) { _context = context; }
public DirectorsController(KinoContext context) { _context = context; }
public ReservationController(KinoContext context) { _context = context; }
public MovieController(KinoContext context) { this.context = context; }
public ShowingController(KinoContext context) { _context = context; }
public KomentariService(KinoContext context, IMapper mapper) : base(context, mapper) { }
public ScreeningController(KinoContext context) { this.context = context; }
public RoomController(KinoContext context) { _context = context; }
public SjedistaService(KinoContext context, IMapper mapper) { _context = context; _mapper = mapper; }
public FilmyRepository(KinoContext context) : base(context) { _context = context; }
public ZanroviService(KinoContext context, IMapper mapper) : base(context, mapper) { }
public ReservationsController(UserManager <User> userManager, KinoContext context) { this.userManager = userManager; this.context = context; }
public KinoGeneric(KinoContext context) { _context = context; }
public BaseCRUDService(KinoContext context, IMapper mapper) : base(context, mapper) { _context = context; _mapper = mapper; }