コード例 #1
0
        public async Task <ActionResult <CompanyAddressForCreation> > AddAddress(int companyId, CompanyAddressForCreation companyAddress)
        {
            if (!await _companyService.CompanyExists(companyId))
            {
                return(NotFound());
            }

            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }

            companyAddress.CompanyId = companyId;

            if (!await _companyService.AddAddress(companyAddress))
            {
                return(StatusCode(500, "A Problem happened while handling your request"));
            }

            return(Ok());
        }