public virtual void Update(T entity) { using (RentaCarContext context = new RentaCarContext()) { var deleteEntity = context.Entry(entity); deleteEntity.State = EntityState.Deleted; context.SaveChanges(); } }
public virtual void Add(T entity) { using (RentaCarContext context = new RentaCarContext()) { var addedEntity = context.Entry(entity); addedEntity.State = EntityState.Added; context.SaveChanges(); } }