//[ResponseType(typeof(IEnumerable<House>))] public async Task <IEnumerable <House> > GetAllHousesAsync() { var list = await m_houseRepository.GetAllAsync(); if (list == null) { throw new HttpResponseException(new HttpResponseMessage(HttpStatusCode.NotFound)); } return(list); }
public async Task <IActionResult> Get() { try { var result = await _houseRepository.GetAllAsync(); return(new ObjectResult(new HouseConverter().Convert(result))); } catch (Exception ex) { return(StatusCode(500, ex)); } }
[HttpGet] //api/house public async Task <List <House> > Index() { return(await _houseRepository.GetAllAsync()); }