public void ModifyUserData(User user)
 {
     using (BuildingServiceContext context = new BuildingServiceContext())
     {
         context.Entry(user).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Example #2
0
 public void Add(TEntity entity)
 {
     using (BuildingServiceContext context = new BuildingServiceContext())
     {
         context.Set <TEntity>().Add(entity);
         context.SaveChanges();
     }
 }
Example #3
0
 public void Update(TEntity entity)
 {
     using (BuildingServiceContext context = new BuildingServiceContext())
     {
         context.Set <TEntity>().Attach(entity);
         context.Entry(entity).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
Example #4
0
        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();
            }
        }