public async Task <ActionResult <Mortgage> > GetMortgage(long id) { var mortgage = await _service.GetMortgage(id); if (mortgage == null) { return(NotFound()); } return(mortgage); }
public IHttpActionResult Get(int id) { var mortgage = mortgageService.GetMortgage(id); if (mortgage == null) { var resp = new HttpResponseMessage(System.Net.HttpStatusCode.NotFound) { Content = new StringContent(string.Format("Mortgage id {0} not found", Convert.ToString(id))), ReasonPhrase = "Mortgage not found" }; throw new HttpResponseException(resp); } return(Ok(mortgage)); }