Beispiel #1
0
 public Product GetById(int id)
 {
     using (EtradeContext context = new EtradeContext())
     {
         return(context.Products.FirstOrDefault(p => p.Id == id));
     }
 }
Beispiel #2
0
 public List <Product> ikiFiyatGetir(decimal min, decimal max)
 {
     using (EtradeContext context = new EtradeContext())
     {
         return(context.Products.Where(p => p.UnitPrice >= min && p.UnitPrice <= max).ToList());
     }
 }
Beispiel #3
0
 public List <Product> GetByName(string key)
 {
     using (EtradeContext context = new EtradeContext())
     {
         return(context.Products.Where(p => p.Name.Contains(key)).ToList());
     }
 }
Beispiel #4
0
 public List <Product> GetAll()
 {
     using (EtradeContext context = new EtradeContext())
     {
         return(context.Products.ToList());
     }
 }
Beispiel #5
0
 public void Sil(Product product)
 {
     using (EtradeContext context = new EtradeContext())
     {
         var entity = context.Entry(product);
         entity.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
Beispiel #6
0
 public void Guncelle(Product product)
 {
     using (EtradeContext context = new EtradeContext())
     {
         var entity = context.Entry(product);
         entity.State = EntityState.Modified;
         context.SaveChanges();
     }
 }