public IActionResult Get(int policyNumber) { CatalogPolicy policy = _policyRepository.Get(policyNumber); if (policy == null) { return(NotFound()); } return(Ok(policy.ToDto())); }
public IActionResult UpdatePolicy([FromBody] PolicyDto dto) { if (!this.ModelState.IsValid) { return(BadRequest()); } CatalogPolicy policy = dto.ToPolicy(); if (_policyRepository.Get(policy.Number) == null) { return(NotFound()); } _policyRepository.Update(policy); CatalogPolicy p = _policyRepository.Get(policy.Number); return(Ok(p.ToDto())); }