public User GetByEmail(string email)
 {
     using (BuildingServiceContext context = new BuildingServiceContext())
     {
         return(context.Set <User>().FirstOrDefault(u => u.Email.Equals(email)));
     }
 }
 public User GetByEmailAndPassword(string email, string password)
 {
     using (BuildingServiceContext context = new BuildingServiceContext())
     {
         return(context.Set <User>().FirstOrDefault(u => u.Email.Equals(email) &&
                                                    u.Password.Equals(password)));
     }
 }
예제 #3
0
 public void Add(TEntity entity)
 {
     using (BuildingServiceContext context = new BuildingServiceContext())
     {
         context.Set <TEntity>().Add(entity);
         context.SaveChanges();
     }
 }
예제 #4
0
 public void Update(TEntity entity)
 {
     using (BuildingServiceContext context = new BuildingServiceContext())
     {
         context.Set <TEntity>().Attach(entity);
         context.Entry(entity).State = EntityState.Modified;
         context.SaveChanges();
     }
 }
예제 #5
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();
            }
        }
예제 #6
0
 protected virtual IQueryable <TEntity> GetEntityQuery(BuildingServiceContext context)
 {
     return(context.Set <TEntity>());
 }