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))); } }
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(); } }
protected virtual IQueryable <TEntity> GetEntityQuery(BuildingServiceContext context) { return(context.Set <TEntity>()); }