public ActionResult Save(FormCollection fc, string[] ids) { Promote_Associate objpt = new Promote_Associate(); //var data = TempData["PLibraryID"]; var data = fc["proLibId"]; var chckedValues = fc.GetValues("ids"); if (ids != null) { foreach (var x in chckedValues) { int asID = Convert.ToInt32(x); var email = (from s in db.RegisterUsers where s.Id == asID select new { s.Email }); string emailid = (email.FirstOrDefault().Email).ToString(); var userName = (from s in db.RegisterUsers where s.Id == asID select new { s.UserNo }); string Uname = (userName.FirstOrDefault().UserNo).ToString(); objpt.PromotionLibraryID = Convert.ToInt32(data); objpt.Id = Convert.ToInt32(x); objpt.IndustriesID = Convert.ToInt32(fc["IndustriesName"]); db.Promote_Associate.Add(objpt); db.SaveChanges(); SendMailModels objModel = new SendMailModels(); objModel.SendMail(Uname, emailid, "Promotional Library", "<div style='font-size:12pt; font-family:Calibri Light;'>Thank you for your patience. You can sign in <a href='http://182.73.96.52:94/AssociateLoginPage/AssociateLogin' style='border: none;'>Click here </a> and check the promotional</b><br/>material for your products. We assure you for quality,experience and services while we expect that you will make the customer confident and convinced about our local presence and services.</div>"); TempData["msg"] = "Promotional material sent to the selected Associate/Worldref User"; TempData["vColor"] = "red"; } } return(RedirectToAction("PromotionDetails", new { PromotionID = data })); }
public ActionResult Save(FormCollection fc, string[] ids) { Promote_Associate objpt = new Promote_Associate(); //var data = TempData["PLibraryID"]; var data = fc["proLibId"]; var chckedValues = fc.GetValues("ids"); if (ids != null) { foreach (var x in chckedValues) { int asID = Convert.ToInt32(x); var email = (from s in db.RegisterUsers where s.Id == asID select new { s.Email }); string emailid = (email.FirstOrDefault().Email).ToString(); var userName = (from s in db.RegisterUsers where s.Id == asID select new { s.UserNo }); string Uname = (userName.FirstOrDefault().UserNo).ToString(); objpt.PromotionLibraryID = Convert.ToInt32(data); objpt.Id = Convert.ToInt32(x); objpt.IndustriesID = Convert.ToInt32(fc["IndustriesName"]); db.Promote_Associate.Add(objpt); db.SaveChanges(); SendMailModels objModel = new SendMailModels(); objModel.SendMail(Uname, emailid, "Promotional Library", "<div style='font-size:12pt; font-family:Calibri Light;'>Thank you for your patience. You can sign in <a href='http://182.73.96.52:94/AssociateLoginPage/AssociateLogin' style='border: none;'>Click here </a> and check the promotional</b><br/>material for your products. We assure you for quality,experience and services while we expect that you will make the customer confident and convinced about our local presence and services.</div>"); TempData["msg"] = "Promotional material sent to the selected Associate/Worldref User"; TempData["vColor"] = "red"; } } return RedirectToAction("PromotionDetails", new { PromotionID = data }); }