Exemplo n.º 1
0
 public List <Categoryes> SelectCategory()
 {
     using (db = new DbContextDrowDataBase())
     {
         return(db.Categoryes.ToList());
     }
 }
Exemplo n.º 2
0
 public void InsertMovie(Movies newMovies)
 {
     using (db = new DbContextDrowDataBase())
     {
         db.Movies.Add(newMovies);
         db.SaveChanges();
     }
 }
Exemplo n.º 3
0
 public void RemoveInvntory(int amout, int idMovie)
 {
     using (db = new DbContextDrowDataBase())
     {
         Movies removeInvntory = db.Movies.FirstOrDefault(m => m.MoviesID.Equals(idMovie));
         removeInvntory.Inventory -= amout;
     }
 }
Exemplo n.º 4
0
 public void AddCustomer(Customer creatNewCustomer)
 {
     using (db = new DbContextDrowDataBase())
     {
         db.Customers.Add(creatNewCustomer);
         db.SaveChanges();
     }
 }
Exemplo n.º 5
0
 public Customer SearchCustomer(string userName, string password)
 {
     using (db = new DbContextDrowDataBase())
     {
         Customer customer = db.Customers.FirstOrDefault(m => m.UserName.Equals(userName) && (m.Pasword.Equals(password)));
         return(customer);
     }
 }
Exemplo n.º 6
0
 public List <Movies> SelectMoviesBest()
 {
     using (db = new DbContextDrowDataBase())
     {
         db = new DbContextDrowDataBase();
         List <Movies> best = db.Movies.OrderByDescending(m => m.Rating).Take(3).ToList();
         return(best);
     }
 }
Exemplo n.º 7
0
        public Customer CheckCustomer(string email, string phone)
        {
            Customer checkCustomer;

            using (db = new DbContextDrowDataBase())
            {
                checkCustomer = db.Customers.FirstOrDefault(m => m.Email.Equals(email) && (m.Phone.Equals(phone)));
            }
            return(checkCustomer);
        }
Exemplo n.º 8
0
 public static List <string> SearchNameMovies(string prefixText, int count)
 {
     using (DbContextDrowDataBase db = new DbContextDrowDataBase())
     {
         List <string> matches = (from m in db.Movies
                                  where m.NameMovies.StartsWith(prefixText)
                                  select m.NameMovies).ToList();
         return(matches);
     }
 }
Exemplo n.º 9
0
        public Manger ChecksItIsManger(string userName, string password)
        {
            Manger checkerItIs;

            using (db = new DbContextDrowDataBase())
            {
                checkerItIs = db.Manger.FirstOrDefault(m => m.UserName.Equals(userName) && (m.Password.Equals(password)));
            }

            return(checkerItIs);
        }
Exemplo n.º 10
0
 public void RatingAdd(int rating, int iDmovies)
 {
     using (db = new DbContextDrowDataBase())
     {
         Movies addRatintToMovies = db.Movies.FirstOrDefault(x => x.MoviesID.Equals(iDmovies));
         addRatintToMovies.Rating          = addRatintToMovies.Rating + rating;
         addRatintToMovies.CuntRating     += 1;
         db.Entry(addRatintToMovies).State = EntityState.Modified;
         db.SaveChanges();
     }
 }
Exemplo n.º 11
0
        public Movies SelectOneMovie(string nameMovies)
        {
            Movies SearchOne;

            using (db = new DbContextDrowDataBase())
            {
                SearchOne = (db.Movies.FirstOrDefault(m => m.NameMovies == nameMovies));
            }

            return(SearchOne);
        }
Exemplo n.º 12
0
        public Movies SelectOneMovie(int MoviesID)
        {
            Movies SearchOne = new Movies();

            if (MoviesID >= 0)
            {
                using (db = new DbContextDrowDataBase())
                {
                    SearchOne = (db.Movies.FirstOrDefault(m => m.MoviesID == MoviesID));
                }
            }
            return(SearchOne);
        }
Exemplo n.º 13
0
        public void RemoveMovie(int id)
        {
            using (db = new DbContextDrowDataBase())
            {
                Movies movies = db.Movies.FirstOrDefault(m => m.MoviesID == id);
                if (movies != null)
                {
                    db.Movies.Remove(movies);

                    db.SaveChanges();
                }
            }
        }
Exemplo n.º 14
0
 public void UpDate(Movies UpDataMo)
 {
     using (db = new DbContextDrowDataBase())
     {
         Movies movies = db.Movies.FirstOrDefault(m => m.MoviesID == UpDataMo.MoviesID);
         movies.NameMovies    = UpDataMo.NameMovies;
         movies.Inventory     = UpDataMo.Inventory;
         movies.Description   = UpDataMo.Description;
         movies.MovieDirector = UpDataMo.MovieDirector;
         movies.CategoryID    = UpDataMo.CategoryID;
         if (UpDataMo.ImageUrlOfMovies != null)
         {
             movies.ImageUrlOfMovies = UpDataMo.ImageUrlOfMovies;
         }
         db.Entry(movies).State = EntityState.Modified;
         db.SaveChanges();
     }
 }