public ActionResult Add(DRP dRP) { Session["CSN"] = dRP.CSN; Session["ISIN"] = dRP.ISIN; Session["DRPAmount"] = dRP.DRPAmount; return(Redirect("details")); }
public ActionResult Details(DRP dRP) { if (Session["CSN"] == null) { return(Redirect("../forms")); } dRP.UserId = int.Parse(Session["UserId"].ToString()); dRP.CSN = Session["CSN"].ToString(); dRP.ISIN = Session["ISIN"].ToString(); dRP.DRPAmount = double.Parse(Session["DRPAmount"].ToString()); dRP.CreatedById = int.Parse(Session["UserId"].ToString()); dRP.CreatedDate = System.DateTime.Now; //save to db _context.DRPs.Add(dRP); _context.SaveChanges(); //initialize sessions Session["CSN"] = null; Session["ISIN"] = null; Session["DRPAmount"] = null; //#region -- Email -- //SendGridHelper emailhelper = new SendGridHelper(); //SendGridModel emailmodel = new SendGridModel(); //var From = new Recipient //{ // Email = "*****@*****.**", // Name = "Raymond Milca" //}; //emailmodel.From = From; //var To = new Recipient //{ // Email = "*****@*****.**", // Name = "Raymond Milca" //}; //emailmodel.To.Add(To); ///*Uncomment if need to attach single or multiple file*/ ////Attachment attachment = new Attachment(@"C:\2BInteractive\Docs\FTPAcct.txt"); ////emailmodel.Attachment.Add(attachment); //emailmodel.Subject = "Email Subject"; //emailmodel.Body = "<strong>Email Body</strong>"; //emailmodel.IsBodyHtml = true; //var success = emailhelper.SendEmail(emailmodel); //#endregion ViewBag.IsView = "Acknowledgement"; return(View()); }