Exemplo n.º 1
0
 public ActionResult applyToAddBeneficiary(BeneficiaryViewModel model, string reason)
 {
     if (ModelState.IsValid)
     {
         var pb       = new PackageBusiness();
         var profileB = new ProfileBusiness();
         for (int x = 0; x < pb.GetAll().Count; x++)
         {
             //find the Policy Holder's package
             if (pb.GetAll()[x].PackageId == pb.GetByName(profileB.getPolicyDetails(HttpContext.User.Identity.Name).packageName).PackageId)
             {
                 //if we haven't reached the maximum number the package can cover, add the beneficiary
                 if (profileB.getBeneficiaries(HttpContext.User.Identity.Name).Count < pb.GetByName(profileB.getPolicyDetails(HttpContext.User.Identity.Name).packageName).maxBeneficiary)
                 {
                     TempData["Error"] = profileB.applyToAddBen(HttpContext.User.Identity.Name, model, reason);
                     break;
                 }
                 else //otherwise return an alert to the user
                 {
                     TempData["Error"] = pb.GetAll()[x].Name + " package can cover up to " + pb.GetAll()[x].maxBeneficiary + " beneficiaries";
                 }
             }
         }
         return(RedirectToAction("attachDocuments"));
     }
     return(View(model));
 }
Exemplo n.º 2
0
 public ActionResult AddPackage(PackageView model)
 {
     if (ModelState.IsValid)
     {
         prepo.AddPackage(model);
         var pb = new PackageBusiness();
         return(RedirectToAction("AddPackageBenefits", new { packID = pb.GetByName(model.Name).PackageId }));
     }
     return(View(model));
 }
Exemplo n.º 3
0
 public ActionResult Search(string name)
 {
     return(View(prepo.GetByName(name)));
 }