Esempio n. 1
0
        public Movie getProduct(int productID)
        {
            using (var context = new MovieStoreEDM())
            {
                Movie movie = (from p in context.Movies1 where p.Id == productID select p).FirstOrDefault <Movie>();

                return(movie);
            }
        }
Esempio n. 2
0
 public Movie getMovieById(int movieId)
 {
     using (var context = new MovieStoreEDM())
     {
         Movie movie = (from c in context.Movies1
                        where c.Id == movieId
                        select c).FirstOrDefault <Movie>();
         return(movie);
     }
 }
Esempio n. 3
0
 public Customer getCustomerByUsername(string username)
 {
     using (var context = new MovieStoreEDM())
     {
         Customer customer = (from c in context.Customers
                              where c.Name == username
                              select c).FirstOrDefault <Customer>();
         return(customer);
     }
 }
Esempio n. 4
0
        public int addNewOrder(Order newOrder)
        {
            using (var context = new MovieStoreEDM())
            {
                context.Orders.Add(newOrder);
                context.SaveChanges();

                return(newOrder.Id);
            }
        }
Esempio n. 5
0
 public List <Movie> getMoviesByGenre(GenreTypes genre)
 {
     using (var context = new MovieStoreEDM())
     {
         List <Movie> movies = (from p in context.Movies1
                                where p.Genre == genre.ToString()
                                select p).ToList <Movie>();
         return(movies);
     }
 }
Esempio n. 6
0
 public OrderItem getOrderItemById(int orderId)
 {
     using (var context = new MovieStoreEDM())
     {
         OrderItem orderItem = (from c in context.OrderItems
                                where c.Id == orderId
                                select c).FirstOrDefault <OrderItem>();
         return(orderItem);
     }
 }
Esempio n. 7
0
 public void addOrderItem(OrderItem orderItem)
 {
     using (var context = new MovieStoreEDM())
     {
         context.OrderItems.Add(orderItem);
         try { context.SaveChanges(); }
         catch
         {
         }
     }
 }
Esempio n. 8
0
 public void updateOrder(Order order)
 {
     using (var context = new MovieStoreEDM())
     {
         Order orderRecord = (from p in context.Orders
                              where p.Id == order.Id
                              select p).FirstOrDefault <Order>();
         orderRecord.Customer = order.Customer;
         orderRecord.Total    = order.Total;
         orderRecord.Status   = 0;
         context.SaveChanges();
     }
 }