public void EmailLOTW(string email, string name, LockOfTheWeek lotw) { var fromAddress = new MailAddress("*****@*****.**", "The Line Sports"); var toAddress = new MailAddress(email, name); string fromPassword = "******"; string subject = lotw.Header; string body = lotw.MSG + Environment.NewLine + Environment.NewLine + "- " + lotw.Footer; var smtp = new SmtpClient { Host = "smtp.gmail.com", Port = 587, EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Credentials = new NetworkCredential(fromAddress.Address, fromPassword) }; using (var message = new MailMessage(fromAddress, toAddress) { Subject = subject, Body = body }) { smtp.Send(message); } }
public ActionResult DeleteConfirmed(byte id) { LockOfTheWeek lockOfTheWeek = db.Locks.Find(id); db.Locks.Remove(lockOfTheWeek); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "Id,Header,MSG,Footer,Active")] LockOfTheWeek lockOfTheWeek) { if (ModelState.IsValid) { db.Entry(lockOfTheWeek).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(lockOfTheWeek)); }
public ActionResult Create([Bind(Include = "Id,Header,MSG,Footer,Active")] LockOfTheWeek lockOfTheWeek) { if (ModelState.IsValid) { db.Locks.Add(lockOfTheWeek); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(lockOfTheWeek)); }
// GET: LockOfTheWeek/Edit/5 public ActionResult Edit(byte?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } LockOfTheWeek lockOfTheWeek = db.Locks.Find(id); if (lockOfTheWeek == null) { return(HttpNotFound()); } return(View(lockOfTheWeek)); }