public Movie GetMovieId(int id) //Get Id of the movie from the database.
 {
     using (OnlineMovieTicketDBContext onlineMovieTicketDBContext = new OnlineMovieTicketDBContext())
     {
         return(onlineMovieTicketDBContext.MovieDetails.Find(id));
     }
 }
Esempio n. 2
0
 public IEnumerable <Category> CategoryDetails()   //Fetch Category from Database.
 {
     using (OnlineMovieTicketDBContext onlineMovieTicketDBContext = new OnlineMovieTicketDBContext())
     {
         return(onlineMovieTicketDBContext.Categories.ToList());;
     }
 }
 public Account CheckUser(Account account) //Check existing user.
 {
     using (OnlineMovieTicketDBContext onlineMovieTicketDBContext = new OnlineMovieTicketDBContext())
     {
         var usr = onlineMovieTicketDBContext.AccountDetails.Where(model => model.Email == account.Email && model.Password == account.Password).FirstOrDefault();
         return(usr);
     }
 }
 public void AddUser(Account account) //Add user to Database
 {
     using (OnlineMovieTicketDBContext onlineMovieTicketDBContext = new OnlineMovieTicketDBContext())
     {
         onlineMovieTicketDBContext.AccountDetails.Add(account);
         onlineMovieTicketDBContext.SaveChanges(); // Update the database
     }
 }
Esempio n. 5
0
 public void AddCategory(Category category)   //Add Category .
 {
     using (OnlineMovieTicketDBContext onlineMovieTicketDBContext = new OnlineMovieTicketDBContext())
     {
         onlineMovieTicketDBContext.Categories.Add(category);
         onlineMovieTicketDBContext.SaveChanges();
     }
 }
 public void UpdateMovie(Movie movie) //Update the movie details to the database.
 {
     using (OnlineMovieTicketDBContext onlineMovieTicketDBContext = new OnlineMovieTicketDBContext())
     {
         onlineMovieTicketDBContext.Entry(movie).State = EntityState.Modified;
         onlineMovieTicketDBContext.SaveChanges();
     }
 }
 public void AddMovie(Movie movie) //Add movies to Database.
 {
     using (OnlineMovieTicketDBContext onlineMovieTicketDBContext = new OnlineMovieTicketDBContext())
     {
         onlineMovieTicketDBContext.MovieDetails.Add(movie);
         onlineMovieTicketDBContext.SaveChanges();
     }
 }
 public IEnumerable <Movie> GetAllMovies() //Get all movies from Database.
 {
     using (OnlineMovieTicketDBContext onlineMovieTicketDBContext = new OnlineMovieTicketDBContext())
     {
         IEnumerable <Movie> movie = onlineMovieTicketDBContext.MovieDetails.Include("Category").ToList();
         return(movie);
     }
 }
 public void DeleteMovie(int movieId) //Delete movie from the database.
 {
     using (OnlineMovieTicketDBContext onlineMovieTicketDBContext = new OnlineMovieTicketDBContext())
     {
         Movie movie = onlineMovieTicketDBContext.MovieDetails.Find(movieId);
         onlineMovieTicketDBContext.MovieDetails.Remove(movie);
         onlineMovieTicketDBContext.SaveChanges();
     }
 }