Esempio n. 1
0
        public async void TestGetAll()
        {
            var users = await _userApplicationService.GetAllAsync();

            Assert.NotNull(users);
            Assert.Equal(6, users.Count);
        }
Esempio n. 2
0
        public async Task <IActionResult> GetAllUsersAsync()
        {
            try
            {
                var response = await _applicationService.GetAllAsync();

                var webResponse = new GetWebResponse <UsersDto>()
                                  .From(response);

                if (webResponse.IsSuccessful)
                {
                    return(Ok(webResponse));
                }

                return(BadRequest(webResponse.Errors));
            }
            catch (Exception ex)
            {
                var message = "Unable to retrieve a list of users";
                Console.WriteLine(ex);
                _logManager.LogError(ex, message);
                return(BadRequest(message));
            }
        }
 public async Task <IEnumerable <string> > Get()
 {
     return((await _userApplicationService.GetAllAsync()).Select(u => u.UserName));
 }
Esempio n. 4
0
 //[CacheOutput(ClientTimeSpan = 100, ServerTimeSpan = 100)] //Install-Package Strathweb.CacheOutput.WebApi2
 public async Task <HttpResponseMessage> GetAllAsync()
 {
     return(await CreateResponse(HttpStatusCode.OK, applicationService.GetAllAsync().Result));
 }