Ejemplo n.º 1
0
        public IActionResult GetOfficesByCountry([FromQuery(Name = "countryId")] int countryId, [FromQuery(Name = "includeCities")] bool includeCities)
        {
            var exists = _countryService.CountryExists(countryId);

            if (exists)
            {
                var officesForCountry = _branchOfficeService.GetByCountryId(countryId, includeCities);

                if (officesForCountry.Count() > 0)
                {
                    return(Ok(officesForCountry));
                }
                else
                {
                    return(NoContent());
                }
            }
            else
            {
                return(NotFound());
            }
        }