Beispiel #1
0
        public IActionResult Get(int policyNumber)
        {
            CatalogPolicy policy = _policyRepository.Get(policyNumber);

            if (policy == null)
            {
                return(NotFound());
            }
            return(Ok(policy.ToDto()));
        }
Beispiel #2
0
        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()));
        }