示例#1
0
        public async Task <Response> GetAll()
        {
            var users = await _userOperations.GetAllAsync();

            var result = _mapper.Map <UserViewModel[]>(users.ToArray());

            return(new Response
            {
                Status = ResponseStatus.Ok,
                Result = result
            });
        }
示例#2
0
        public async Task <Response> GetAll()
        {
            var users = await _userOperations.GetAllAsync();

            var userModels = users.Select(x => new UserViewModel
            {
                FirstName = x.FirstName,
                Id        = x.Id,
                LastName  = x.LastName,
                Username  = x.Username
            });

            return(new Response
            {
                Status = ResponseStatus.Ok,
                Result = userModels
            });
        }
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 public static IList <User> GetAll(this IUserOperations operations)
 {
     return(operations.GetAllAsync().GetAwaiter().GetResult());
 }