コード例 #1
0
 public ActionResult AddDocuments(DocumentViewModel model, HttpPostedFileBase upload)
 {
     if (ModelState.IsValid)
     {
         byte[] uploadedFile = new byte[upload.InputStream.Length];
         upload.InputStream.Read(uploadedFile, 0, uploadedFile.Length);
         model.document = uploadedFile;
         var pb = new ProfileBusiness();
         pb.UploadDocument(model);
         if (pb.NumberOfOutstandingDocs(HttpContext.User.Identity.Name) == 0)
         {
             var EB = new EmailBusiness();
             EB.to   = new MailAddress(pb.getContactDetails(HttpContext.User.Identity.Name).emailAdress);
             EB.sub  = "Application Recieved - Mpiti Funeral Undertakers";
             EB.body = "This is to confirm that your application for adding one more beneficiary was recieved for our kind consideration."
                       + "<br/>Look forward to recieve a report in 3 to 5 working days.. "
                       + "<br/><br/> Regards<br/><b>Mpiti Funeral Undertakers - Communications Team</b>";
             EB.Notification();
             ViewBag.Feedback = "Application submitted, look forward to recieve a report in 3 to 5 working days..";
             return(RedirectToAction("Feedback", new { message = ViewBag.Feedback }));
         }
     }
     return(RedirectToAction("attachDocuments"));
 }