public IActionResult CreateOffice([FromBody] BranchOfficeDTO office) { if (office == null) { return(BadRequest()); } var cityId = office.CityId; if (!_branchOfficeService.CityExists(cityId)) { return(NotFound()); } if (_branchOfficeService.OfficeExistsByCityId(cityId)) { return(BadRequest()); } else { var newOffice = _branchOfficeService.Create(office); return(Ok(newOffice)); } }