public IActionResult GetAdults() { IEnumerable <Adult> adults = AdultService.GetAdultAsync(); Console.WriteLine(adults); return(Ok(adults)); }
public async Task <ActionResult <Adult> > GetAdult([FromRoute] string address, [FromRoute] int id) { try { Adult adult = await adultService.GetAdultAsync(id, address); return(Ok(adult)); } catch (Exception e) { return(StatusCode(500, e.Message)); } }
public async Task <ActionResult <IList <Adult> > > GetAdults([FromQuery] string name, [FromQuery] int?age, [FromQuery] int?id) { try { IList <Adult> adults = await adultService.GetAdultAsync(name, age, id); return(Ok(adults)); } catch (Exception e) { Console.WriteLine(e); return(StatusCode(500, e.Message)); } }
public async Task <ActionResult <Adult> > GetAdultAsync([FromRoute] int id) { try { Adult adultAsync = await _adultService.GetAdultAsync(id); return(Ok(adultAsync)); } catch (Exception e) { Console.WriteLine(e.StackTrace); throw; } }
public async Task <ActionResult <IList <Adult> > > GetAdults() { try { IList <Adult> adults = await adultService.GetAdultAsync(); return(Ok(adults)); } catch (Exception e) { Console.WriteLine(e); return(StatusCode(500, e.Message)); } }