Exemplo n.º 1
0
 public List <Order> Read()
 {
     using (var db = new MovieShopContext())
     {
         return(db.Orders.Include("Customer").ToList());
     }
 }
Exemplo n.º 2
0
 public Address Read(int id)
 {
     using (var db = new MovieShopContext())
     {
         return(db.Addresses.FirstOrDefault(x => x.Id == id));
     }
 }
Exemplo n.º 3
0
 public Genre Read(int id)
 {
     using (var db = new MovieShopContext())
     {
         return(db.Genres.FirstOrDefault(x => x.GenreId == id));
     }
 }
Exemplo n.º 4
0
 public IEnumerable <Order> ReadAll()
 {
     using (var ctx = new MovieShopContext())
     {
         return(ctx.Orders.Include(x => x.Customer).ToList());
     }
 }
Exemplo n.º 5
0
 protected override List <Customer> ReadAll(MovieShopContext movieShopContext)
 {
     return(movieShopContext.Set <Customer>()
            .Include(x => x.Order)
            .Include(x => x.Address)
            .ToList());
 }
Exemplo n.º 6
0
 public List <Order> GetAll()
 {
     using (var db = new MovieShopContext())
     {
         return(db.Orders.Include("Customers").Include("Movies").ToList());
     }
 }
Exemplo n.º 7
0
 protected override List <Movie> ReadAll(MovieShopContext movieShopContext)
 {
     return(movieShopContext.Set <Movie>()
            .Include(x => x.Genre)
            .Include(x => x.Orders)
            .ToList());
 }
Exemplo n.º 8
0
 public IEnumerable <Customer> ReadAll()
 {
     using (var ctx = new MovieShopContext())
     {
         return(ctx.Customers.ToList());
     }
 }
Exemplo n.º 9
0
 public Customer ReadById(int Id)
 {
     using (var ctx = new MovieShopContext())
     {
         return(ctx.Customers.FirstOrDefault(cust => cust.Id == Id));
     }
 }
Exemplo n.º 10
0
 IEnumerable <Movie> IRepository <Movie> .ReadAll()
 {
     using (var ctx = new MovieShopContext())
     {
         return(ctx.Movies.Include("Genre").ToList());
     }
 }
Exemplo n.º 11
0
 public Movie ReadById(int Id)
 {
     using (var ctx = new MovieShopContext())
     {
         return(ctx.Movies.Include("Genre").FirstOrDefault(x => x.Id == Id));
     }
 }
Exemplo n.º 12
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public List <Movie> ReadAll()
 {
     using (var ctx = new MovieShopContext())
     {
         return(ctx.Movies.Include("Genres").ToList());
     }
 }
Exemplo n.º 13
0
 public List <Customer> Read()
 {
     using (var db = new MovieShopContext())
     {
         return(db.Customers.Include("Address").ToList());
     }
 }
Exemplo n.º 14
0
 public Customer Read(int id)
 {
     using (var db = new MovieShopContext())
     {
         return(db.Customers.Include("Address").FirstOrDefault(x => x.CustomerId == id));
     }
 }
Exemplo n.º 15
0
 public Customer Read(int id)
 {
     using (dbContext = new MovieShopContext())
     {
         return(dbContext.Customers.Include("Orders").Include("Address").FirstOrDefault(x => x.Id == id));
     }
 }
Exemplo n.º 16
0
 public Customer ReadByEmail(string Email)
 {
     using (var ctx = new MovieShopContext())
     {
         return(ctx.Customers.FirstOrDefault(cust => cust.Email.Equals(Email)));
     }
 }
Exemplo n.º 17
0
 public List <Customer> ReadAll()
 {
     using (dbContext = new MovieShopContext())
     {
         return(dbContext.Customers.Include("Address").ToList());
     }
 }
Exemplo n.º 18
0
 public Genre Get(int id)
 {
     using (var ctx = new MovieShopContext())
     {
         return(ctx.Genres.FirstOrDefault(x => x.ID == id));
     }
 }
Exemplo n.º 19
0
 public Order Get(int id)
 {
     using (var db = new MovieShopContext())
     {
         return(db.Orders.FirstOrDefault(x => x.ID == id));
     }
 }
Exemplo n.º 20
0
 public List <Genre> GetAll()
 {
     using (var ctx = new MovieShopContext())
     {
         return(ctx.Genres.ToList());
     }
 }
Exemplo n.º 21
0
 protected override Movie ReadOne(int id, MovieShopContext movieShopContext)
 {
     return(movieShopContext.Set <Movie>()
            .Include(x => x.Genre)
            .Include(x => x.Orders)
            .FirstOrDefault(x => x.Id == id));
 }
Exemplo n.º 22
0
 public Order Read(int id)
 {
     using (dbContext = new MovieShopContext())
     {
         return(dbContext.Orders.Include("Customer").Include("Movie").FirstOrDefault(x => x.Id == id));
     }
 }
Exemplo n.º 23
0
 public Order ReadById(int Id)
 {
     using (var ctx = new MovieShopContext())
     {
         return(ctx.Orders.FirstOrDefault(order => order.Id == Id));
     }
 }
Exemplo n.º 24
0
 public List <Order> ReadAll()
 {
     using (dbContext = new MovieShopContext())
     {
         return(dbContext.Orders.Include("Customer").Include("Movie").ToList());
     }
 }
Exemplo n.º 25
0
 protected override Customer ReadOne(int id, MovieShopContext movieShopContext)
 {
     return(movieShopContext.Set <Customer>()
            .Include(x => x.Order)
            .Include(x => x.Address)
            .FirstOrDefault(x => x.Id == id));
 }
Exemplo n.º 26
0
 public IEnumerable <Genre> ReadAll()
 {
     using (var ctx = new MovieShopContext())
     {
         return(ctx.Genres.ToList());
     }
 }
Exemplo n.º 27
0
 public List <Address> Read()
 {
     using (var db = new MovieShopContext())
     {
         return(db.Addresses.ToList());
     }
 }
Exemplo n.º 28
0
 public Genre ReadById(int Id)
 {
     using (var ctx = new MovieShopContext())
     {
         return(ctx.Genres.Where(ge => ge.Id == Id).FirstOrDefault());
     }
 }
Exemplo n.º 29
0
 public List <Genre> Read()
 {
     using (var db = new MovieShopContext())
     {
         return(db.Genres.ToList());
     }
 }
Exemplo n.º 30
0
        public Order Create(Order t)
        {
            using (var db = new MovieShopContext())
            {
                t.Customer = db.Customers.Include(x => x.Address).FirstOrDefault(x => x.CustomerId == t.Customer.CustomerId);

                var tmpList = new List <Movie>();

                foreach (var movie in db.Movies)
                {
                    foreach (var moviesToBuy in t.Movies)
                    {
                        if (movie.Title == moviesToBuy.Title)
                        {
                            tmpList.Add(movie);
                        }
                    }
                }


                t.Movies = tmpList;


                db.Orders.Add(t);
                db.SaveChanges();
                return(t);
            }
        }