public void ModifyUserData(User user) { using (BuildingServiceContext context = new BuildingServiceContext()) { context.Entry(user).State = EntityState.Modified; context.SaveChanges(); } }
public void Add(TEntity entity) { using (BuildingServiceContext context = new BuildingServiceContext()) { context.Set <TEntity>().Add(entity); context.SaveChanges(); } }
public void Update(TEntity entity) { using (BuildingServiceContext context = new BuildingServiceContext()) { context.Set <TEntity>().Attach(entity); context.Entry(entity).State = EntityState.Modified; context.SaveChanges(); } }
public void Delete(int Id) { using (BuildingServiceContext context = new BuildingServiceContext()) { TEntity entity = GetByIdInternal(context, Id); if (entity == null) { return; } context.Set <TEntity>().Remove(entity); context.SaveChanges(); } }