コード例 #1
0
 public static Category GetCategoryById(int categoryId)
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         return(c.Category.Find(categoryId));
     }
 }
コード例 #2
0
 public static List <Director> GetDirectorList()
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         return(c.Director.ToList());
     }
 }
コード例 #3
0
 public static Hall GetHallById(int hallId)
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         return(c.Hall.Find(hallId));
     }
 }
コード例 #4
0
 public static Ticket GetTicketByShowtimesIdAndChairId(int showtimesId, int chairId)
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         return(c.Ticket.Where(x => x.ShowtimesId == showtimesId && x.ChairId == chairId).FirstOrDefault());
     }
 }
コード例 #5
0
 public static List <TicketModel> GetTicketModelList()
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         List <TicketModel> ticketModels = new List <TicketModel>();
         List <Ticket>      tickets      = GetTicketList();
         foreach (var item in tickets)
         {
             TicketModel ticketModel = new TicketModel();
             ticketModel.TicketId  = item.TicketId;
             ticketModel.Showtimes = HelperShowtimes.GetShowtimesById(item.ShowtimesId);
             ticketModel.Chair     = HelperChair.GetChairById(item.ChairId);
             if (item.Type == 0)
             {
                 ticketModel.Type = "Tam";
             }
             else if (item.Type == 1)
             {
                 ticketModel.Type = "İndirimli";
             }
             ticketModel.User = HelperUser.GetUserById(item.UserId);
         }
         return(ticketModels);
     }
 }
コード例 #6
0
 public static Director GetDirectorById(int directorId)
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         return(c.Director.Find(directorId));
     }
 }
コード例 #7
0
 public static List <Showtimes> GetShowtimesListByHallIdAndDate(int hallId, DateTime dateTime)
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         return(c.Showtimes.Where(x => x.HallId == hallId && x.Date.Day == dateTime.Day && x.Date.Month == dateTime.Month && x.Date.Year == dateTime.Year).ToList());
     }
 }
コード例 #8
0
 public static User GetUserById(int userId)
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         return(c.User.Find(userId));
     }
 }
コード例 #9
0
 public static Chair GetChairByShowtimesIdAndName(int showtimesId, string name)
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         return(c.Chair.Where(x => x.ShowtimesId == showtimesId && x.Name == name).FirstOrDefault());
     }
 }
コード例 #10
0
 public static List <User> GetList()
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         return(c.User.ToList());
     }
 }
コード例 #11
0
 public static Chair GetChairById(int chairId)
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         return(c.Chair.Find(chairId));
     }
 }
コード例 #12
0
 public static List <Chair> GetChairsByShowtimesId(int showtimesId)
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         return(c.Chair.Where(x => x.ShowtimesId == showtimesId).ToList());
     }
 }
コード例 #13
0
 public static List <Showtimes> GetShowtimesList()
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         return(c.Showtimes.ToList());
     }
 }
コード例 #14
0
 public static List <Movie> GetMovieList()
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         return(c.Movie.ToList());
     }
 }
コード例 #15
0
 public static Showtimes GetShowtimesByHallIdAndDateAndClock(int hallId, DateTime dateTime, string _clock)
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         int clock = 0;
         if (_clock == "09:00")
         {
             clock = 1;
         }
         else if (_clock == "12:00")
         {
             clock = 2;
         }
         else if (_clock == "15:00")
         {
             clock = 3;
         }
         else if (_clock == "18:00")
         {
             clock = 4;
         }
         else if (_clock == "21:00")
         {
             clock = 5;
         }
         return(c.Showtimes.Where(x => x.HallId == hallId && x.Date.Day == dateTime.Day && x.Date.Month == dateTime.Month && x.Date.Year == dateTime.Year && x.Clock == clock).FirstOrDefault());
     }
 }
コード例 #16
0
 public static List <Ticket> GetTicketList()
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         return(c.Ticket.ToList());
     }
 }
コード例 #17
0
 public static Movie GetMovieById(int movieId)
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         return(c.Movie.Find(movieId));
     }
 }
コード例 #18
0
 public static Showtimes GetShowtimesById(int showtimesId)
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         return(c.Showtimes.Find(showtimesId));
     }
 }
コード例 #19
0
 public static List <Hall> GetHallList()
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         return(c.Hall.ToList());
     }
 }
コード例 #20
0
 public static List <Category> GetCategoryList()
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         return(c.Category.ToList());
     }
 }
コード例 #21
0
 public static (Hall, bool) HallCUD(Hall hall, EntityState entityState)
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         c.Entry(hall).State = entityState;
         if (c.SaveChanges() > 0)
         {
             return(hall, true);
         }
         else
         {
             return(hall, false);
         }
     }
 }
コード例 #22
0
 public static (Director, bool) DirectorCUD(Director director, EntityState entityState)
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         c.Entry(director).State = entityState;
         if (c.SaveChanges() > 0)
         {
             return(director, true);
         }
         else
         {
             return(director, false);
         }
     }
 }
コード例 #23
0
 public static (Ticket, bool) TicketCUD(Ticket ticket, EntityState entityState)
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         c.Entry(ticket).State = entityState;
         if (c.SaveChanges() > 0)
         {
             return(ticket, true);
         }
         else
         {
             return(ticket, false);
         }
     }
 }
コード例 #24
0
 public static (Movie, bool) MovieCUD(Movie movie, EntityState entityState)
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         c.Entry(movie).State = entityState;
         if (c.SaveChanges() > 0)
         {
             return(movie, true);
         }
         else
         {
             return(movie, false);
         }
     }
 }
コード例 #25
0
 public static (Chair, bool) ChairCUD(Chair chair, EntityState entityState)
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         c.Entry(chair).State = entityState;
         if (c.SaveChanges() > 0)
         {
             return(chair, true);
         }
         else
         {
             return(chair, false);
         }
     }
 }
コード例 #26
0
 public static (Category, bool) CategoryCUD(Category category, EntityState entityState)
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         c.Entry(category).State = entityState;
         if (c.SaveChanges() > 0)
         {
             return(category, true);
         }
         else
         {
             return(category, false);
         }
     }
 }
コード例 #27
0
 public static (Showtimes, bool) ShowtimesCUD(Showtimes showtimes, EntityState entityState)
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         c.Entry(showtimes).State = entityState;
         if (c.SaveChanges() > 0)
         {
             return(showtimes, true);
         }
         else
         {
             return(showtimes, false);
         }
     }
 }
コード例 #28
0
 public static List <HallModel> GetHallModelList()
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         List <HallModel> hallModels = new List <HallModel>();
         List <Hall>      halls      = GetHallList();
         foreach (var item in halls)
         {
             HallModel hallModel = new HallModel();
             hallModel.HallId = item.HallId;
             hallModel.Name   = item.Name;
             hallModel.Movie  = HelperMovie.GetMovieById(item.MovieId);
             hallModels.Add(hallModel);
         }
         return(hallModels);
     }
 }
コード例 #29
0
 public static List <DirectorModel> GetDirectorModelList()
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         List <DirectorModel> directorModels = new List <DirectorModel>();
         List <Director>      directors      = GetDirectorList();
         foreach (var item in directors)
         {
             DirectorModel directorModel = new DirectorModel();
             directorModel.DirectorId = item.DirectorId;
             directorModel.Name       = item.Name;
             directorModel.Surname    = item.Surname;
             directorModel.FullName   = item.Name + " " + item.Surname;
             directorModels.Add(directorModel);
         }
         return(directorModels);
     }
 }
コード例 #30
0
 public static List <MovieModel> GetMovieModelList()
 {
     using (CinemaDbEntities c = new CinemaDbEntities())
     {
         List <MovieModel> movieModels = new List <MovieModel>();
         List <Movie>      movies      = GetMovieList();
         foreach (var item in movies)
         {
             MovieModel movieModel = new MovieModel();
             movieModel.MovieId     = item.MovieId;
             movieModel.Name        = item.Name;
             movieModel.Category    = HelperCategory.GetCategoryById(item.CategoryId);
             movieModel.Director    = HelperDirector.GetDirectorById(item.DirectorId);
             movieModel.Description = item.Description;
             movieModel.Banner      = item.Banner;
             movieModel.Minutes     = item.Minutes;
             movieModels.Add(movieModel);
         }
         return(movieModels);
     }
 }