partial void DeletesubscribedEmail(subscribedEmail instance);
partial void UpdatesubscribedEmail(subscribedEmail instance);
public ActionResult test() { string path = Server.MapPath("~/pdf/file2.csv"); StreamReader sr = new StreamReader(path); // for set encoding // StreamReader sr = new StreamReader(@"file.csv", Encoding.GetEncoding(1250)); string strline = ""; string[] _values = null; int x = 0; while (!sr.EndOfStream) { x++; strline = sr.ReadLine(); _values = strline.Split(','); for (int i = 0; i < _values.Length; i++) { if (_values[i].Trim().Length > 0) { subscribedEmail se = new subscribedEmail(); se.createdDate = DateTime.Now; se.email = _values[i]; //se.name = subEmail.name; //se.mobileNo = subEmail.phoneNumber; db2.subscribedEmails.InsertOnSubmit(se); db2.SubmitChanges(); } } //if (_values[0].Trim().Length > 0) //{ // //MessageBox.show(_values[1]); //} } sr.Close(); return View(); }
partial void InsertsubscribedEmail(subscribedEmail instance);
public ActionResult Subscribed(SubscribedModel subEmail) { if (ModelState.IsValid) { subscribedEmail se = new subscribedEmail(); se.createdDate = DateTime.Now; se.email = subEmail.email; se.name = subEmail.name; se.mobileNo = subEmail.phoneNumber; db2.subscribedEmails.InsertOnSubmit(se); db2.SubmitChanges(); return RedirectToAction("thankyou"); } else { return View(); } }