Esempio n. 1
0
        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()));
        }
Esempio n. 2
0
        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);
        }