Ejemplo n.º 1
0
 public Product GetById(int id)
 {
     using (EtradeContext context = new EtradeContext())
     {
         return(context.Products.FirstOrDefault(p => p.Id == id));
     }
 }
Ejemplo n.º 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());
     }
 }
Ejemplo n.º 3
0
 public List <Product> GetByName(string key)
 {
     using (EtradeContext context = new EtradeContext())
     {
         return(context.Products.Where(p => p.Name.Contains(key)).ToList());
     }
 }
Ejemplo n.º 4
0
 public List <Product> GetAll()
 {
     using (EtradeContext context = new EtradeContext())
     {
         return(context.Products.ToList());
     }
 }
Ejemplo n.º 5
0
 public void Sil(Product product)
 {
     using (EtradeContext context = new EtradeContext())
     {
         var entity = context.Entry(product);
         entity.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
Ejemplo n.º 6
0
 public void Guncelle(Product product)
 {
     using (EtradeContext context = new EtradeContext())
     {
         var entity = context.Entry(product);
         entity.State = EntityState.Modified;
         context.SaveChanges();
     }
 }