public IEnumerable <string> Get()
 {
     if (_visitorService == null)
     {
         return(new string[] { "No database connection" });
     }
     else
     {
         return(_visitorService.GetAll());
     }
 }
 public async Task <ActionResult> GetAll([FromServices] IVisitorService service)
 {
     if (!ModelState.IsValid)
     {
         return(BadRequest(ModelState));
     }
     try
     {
         return(Ok(await service.GetAll()));
     }
     catch (ArgumentException e)
     {
         return(StatusCode((int)HttpStatusCode.InternalServerError, e.Message));
     }
 }
        public async Task <IActionResult> Get()
        {
            IEnumerable <VisitorDto> visitors = await _visitorService.GetAll();

            return(Ok(visitors));
        }
Пример #4
0
 public async Task <IActionResult> GetAll()
 {
     return(Ok(await _visitorService.GetAll()));
 }