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 PolicyDetails()
        {
            ProfileBusiness pb = new ProfileBusiness();

            if (User.IsInRole("Policy Holder"))
            {
                return(View(pb.getPolicyDetails(HttpContext.User.Identity.Name)));
            }
            TempData["Error"] = "You are not recognized as a Policy Holder, Therefore some content was hiden for privacy";
            return(View());
        }