public User GetUserByEmail(string email) { var specification = new RetrievableUserSpecification(email); return(DataContext.Users .Where(specification.IsSatisfied()) .SingleOrDefault(u => u.Email == email)); }
public PagingQueryResponse <User> GetUsers(PagingQueryRequest query) { var specification = new RetrievableUserSpecification(query.Keyword); var totalCount = ReadOnlyDataContext.Users.Where(specification.IsSatisfied()).AsNoTracking().Count(); var result = new PagingQueryResponse <User> { PageSize = query.PageSize, CurrentPage = query.PageIndex, TotalCount = totalCount, Result = ReadOnlyDataContext.Users .Where(specification.IsSatisfied()) .Include(c => c.Profile) .OrderByDescending(c => c.CreationDate) .Skip((query.PageIndex - 1) * query.PageSize) .Take(query.PageSize).ToList() }; return(result); }
public User GetUserDetailById(Guid userId) { var specification = new RetrievableUserSpecification(null); return(DataContext.Users .Where(specification.IsSatisfied()) .Include(u => u.Profile) .Include(u => u.Profile.Avatar) .Include(u => u.Role) .SingleOrDefault()); }
public User GetUserById(Guid userId) { var specification = new RetrievableUserSpecification(null); return(DataContext.Users.Where(specification.IsSatisfied()).SingleOrDefault(u => u.Id == userId)); }