Пример #1
0
 public IActionResult Get([FromQuery] string nameOfInsuredObject, [FromQuery] DateTime effectiveDate)
 {
     try
     {
         var insuranceCompany = insuranceCompanyService.Get();
         return(Ok(insuranceCompany.GetPolicy(nameOfInsuredObject, effectiveDate)));
     }
     catch (EffectivePolicyNotFoundException)
     {
         return(NotFound(new
         {
             nameOfInsuredObject,
             effectiveDate
         }));
     }
 }
Пример #2
0
        public async Task <ActionResult <InsuranceCompany> > GetInsuranceCompany(string id)
        {
            var insuranceCompany = await _insuranceCompanyService.Get(id) ?? new InsuranceCompany();

            return(Ok(insuranceCompany));
        }