public List <UserDTO> GetAll() { var users = _context.ApplicationUsers .Include(ur => ur.UserRoles) .ThenInclude(r => r.Role) .Include(a => a.Affiliate) .Select(x => UserMapper.ApplicationUserToDTO(x)) .ToList(); return(users); }
public List <UserDTO> GetAffiliateUsers(int affiliateId) { var users = _context.ApplicationUsers .Include(ur => ur.UserRoles) .ThenInclude(r => r.Role) .Where(u => u.AffiliateId.Equals(affiliateId)) .Select(x => UserMapper.ApplicationUserToDTO(x)) .ToList(); return(users); }
public UserDTO GetByUsername(string username) { var applicationUser = _context.ApplicationUsers .Include(ur => ur.UserRoles) .ThenInclude(r => r.Role) .Include(a => a.Affiliate) .SingleOrDefault(x => x.UserName.Equals(username)); if (applicationUser == null) { return(null); } return(UserMapper.ApplicationUserToDTO(applicationUser)); }
public UserDTO GetCurrent() { var applicationUser = _context.ApplicationUsers .Include(ur => ur.UserRoles) .ThenInclude(r => r.Role) .Include(a => a.Affiliate) .SingleOrDefault(x => x.Id.Equals(_userProviderService.GetUserId())); if (applicationUser == null) { return(null); } return(UserMapper.ApplicationUserToDTO(applicationUser)); }