public UserLite GetUserDetails(string userId) { User user = Repository.Single<User>(x => x.UserId.Equals(userId) && x.Deleted != true); if (user == null) throw new UserNotFoundException("User not found."); UserLite lite = new UserLite(); lite.CopyFromUser(user); return lite; }
public List<UserLite> GetAllUsersLite(int startCount = 0, int takeCount = 50) { List<UserLite> results = new List<UserLite>(); var query = Repository.Query<User>(u => u.Deleted == false). OrderByDescending(u => u.CreatedAt). Skip(startCount). Take(takeCount); if (query.Any()) { // There are results to send back, but we should not send complete objects. foreach (User user in query.AsEnumerable<User>()) { UserLite liteUser = new UserLite(); liteUser.CopyFromUser(user); results.Add(liteUser); } } return results; }