public IActionResult GetLocation(string id) { Location location = _companyRepo.ReadLocation(id); if (location == null) { NotFound("Location Not Found"); } var model = LocationModel.FromEntity(location); return(Ok(model.AsResource())); }
private static HalResource <CompanyModel> BuildCompanyResource(Company company) { var companyRes = CompanyModel.FromEntity(company).AsResource(); // Embedded the corporate address: if (company.CorporateLocation != null) { var corpLocRes = LocationModel.FromEntity(company.CorporateLocation).AsResource(); companyRes.EmbedResource(corpLocRes, "corp-location"); } return(companyRes); }