public static Category GetCategoryById(int categoryId) { using (CinemaDbEntities c = new CinemaDbEntities()) { return(c.Category.Find(categoryId)); } }
public static List <Director> GetDirectorList() { using (CinemaDbEntities c = new CinemaDbEntities()) { return(c.Director.ToList()); } }
public static Hall GetHallById(int hallId) { using (CinemaDbEntities c = new CinemaDbEntities()) { return(c.Hall.Find(hallId)); } }
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()); } }
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); } }
public static Director GetDirectorById(int directorId) { using (CinemaDbEntities c = new CinemaDbEntities()) { return(c.Director.Find(directorId)); } }
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()); } }
public static User GetUserById(int userId) { using (CinemaDbEntities c = new CinemaDbEntities()) { return(c.User.Find(userId)); } }
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()); } }
public static List <User> GetList() { using (CinemaDbEntities c = new CinemaDbEntities()) { return(c.User.ToList()); } }
public static Chair GetChairById(int chairId) { using (CinemaDbEntities c = new CinemaDbEntities()) { return(c.Chair.Find(chairId)); } }
public static List <Chair> GetChairsByShowtimesId(int showtimesId) { using (CinemaDbEntities c = new CinemaDbEntities()) { return(c.Chair.Where(x => x.ShowtimesId == showtimesId).ToList()); } }
public static List <Showtimes> GetShowtimesList() { using (CinemaDbEntities c = new CinemaDbEntities()) { return(c.Showtimes.ToList()); } }
public static List <Movie> GetMovieList() { using (CinemaDbEntities c = new CinemaDbEntities()) { return(c.Movie.ToList()); } }
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()); } }
public static List <Ticket> GetTicketList() { using (CinemaDbEntities c = new CinemaDbEntities()) { return(c.Ticket.ToList()); } }
public static Movie GetMovieById(int movieId) { using (CinemaDbEntities c = new CinemaDbEntities()) { return(c.Movie.Find(movieId)); } }
public static Showtimes GetShowtimesById(int showtimesId) { using (CinemaDbEntities c = new CinemaDbEntities()) { return(c.Showtimes.Find(showtimesId)); } }
public static List <Hall> GetHallList() { using (CinemaDbEntities c = new CinemaDbEntities()) { return(c.Hall.ToList()); } }
public static List <Category> GetCategoryList() { using (CinemaDbEntities c = new CinemaDbEntities()) { return(c.Category.ToList()); } }
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); } } }
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); } } }
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); } } }
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); } } }
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); } } }
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); } } }
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); } } }
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); } }
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); } }
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); } }