Exemplo n.º 1
0
 public void Update(Payment entity)
 {
     using (CarRentalContext context = new CarRentalContext())
     {
         var updatedEntity = context.Entry(entity);
         updatedEntity.State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public void Delete(Payment entity)
 {
     using (CarRentalContext context = new CarRentalContext())
     {
         var deletedEntity = context.Entry(entity);
         deletedEntity.State = EntityState.Deleted;
         context.SaveChanges();
     }
 }
Exemplo n.º 3
0
 public List <Payment> GetAll(Expression <Func <Payment, bool> > filter = null)
 {
     using (CarRentalContext context = new CarRentalContext())
     {
         return(filter == null
             ? context.Set <Payment>().ToList()
             : context.Set <Payment>().Where(filter).ToList());
     }
 }
Exemplo n.º 4
0
 public void Add(Payment entity)
 {
     using (CarRentalContext context = new CarRentalContext())
     {
         var addedEntity = context.Entry(entity);
         addedEntity.State = EntityState.Added;
         context.SaveChanges();
     }
 }