public async Task <IActionResult> AddPolicy(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var customer = await _context.Customers.FindAsync(id.Value);

            if (customer == null)
            {
                return(NotFound());
            }

            var model = new PolicyViewModel
            {
                CustomerId    = customer.Id,
                CoveringTypes = _combosHelper.GetComboCoveringTypes(),
                RiskTypes     = _combosHelper.GetComboRiskTypes(),
            };

            return(View(model));
        }
 public PolicyViewModel ToPolicyViewModel(Policy policy)
 {
     return(new PolicyViewModel
     {
         PolicyName = policy.PolicyName,
         Description = policy.Description,
         PolicyStartDate = policy.PolicyStartDate,
         CoveringPeriod = policy.CoveringPeriod,
         Price = policy.Price,
         Customer = policy.Customer,
         Id = policy.Id,
         CoveringTypes = _combosHelper.GetComboCoveringTypes(),
         RiskTypes = _combosHelper.GetComboRiskTypes(),
         CustomerId = policy.Customer.Id,
         State = policy.State,
         CoveringTypeId = policy.CoveringType.Id,
         RiskTypeId = policy.RiskType.Id,
     });
 }