Exemplo n.º 1
0
        public User GetUserByEmail(string email)
        {
            var specification = new RetrievableUserSpecification(email);

            return(DataContext.Users
                   .Where(specification.IsSatisfied())
                   .SingleOrDefault(u => u.Email == email));
        }
Exemplo n.º 2
0
        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);
        }
Exemplo n.º 3
0
        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());
        }
Exemplo n.º 4
0
        public User GetUserById(Guid userId)
        {
            var specification = new RetrievableUserSpecification(null);

            return(DataContext.Users.Where(specification.IsSatisfied()).SingleOrDefault(u => u.Id == userId));
        }