public ActionResult Create([Bind(Include = "CentralAjudaCliId,ClienteId,From,To,Subject,Body")] CentralAjudaCli centralAjudaCli, MandAjuda.Models.Chamado _objModelMail) { if (ModelState.IsValid) { db.CentralAjudaCli.Add(centralAjudaCli); db.SaveChanges(); MailMessage mail = new MailMessage(); mail.To.Add(_objModelMail.To); mail.From = new MailAddress(_objModelMail.From); mail.Subject = _objModelMail.Subject; string Body = _objModelMail.Body; mail.Body = Body; mail.IsBodyHtml = true; SmtpClient smtp = new SmtpClient(); smtp.Host = "smtp.gmail.com"; smtp.Port = 587; smtp.UseDefaultCredentials = false; smtp.Credentials = new System.Net.NetworkCredential ("*****@*****.**", "Mand@judaPI"); smtp.EnableSsl = true; smtp.Send(mail); return(RedirectToAction("Index")); } ViewBag.ClienteId = new SelectList(db.Clientes, "ClienteId", "Nome", centralAjudaCli.ClienteId); return(View(centralAjudaCli)); }
public ActionResult DeleteConfirmed(int id) { CentralAjudaCli centralAjudaCli = db.CentralAjudaCli.Find(id); db.CentralAjudaCli.Remove(centralAjudaCli); db.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult Edit([Bind(Include = "CentralAjudaCliId,ClienteId,From,To,Subject,Body")] CentralAjudaCli centralAjudaCli) { if (ModelState.IsValid) { db.Entry(centralAjudaCli).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } ViewBag.ClienteId = new SelectList(db.Clientes, "ClienteId", "Nome", centralAjudaCli.ClienteId); return(View(centralAjudaCli)); }
// GET: CentralAjudaCli/Details/5 public ActionResult Details(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CentralAjudaCli centralAjudaCli = db.CentralAjudaCli.Find(id); if (centralAjudaCli == null) { return(HttpNotFound()); } return(View(centralAjudaCli)); }
// GET: CentralAjudaCli/Edit/5 public ActionResult Edit(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } CentralAjudaCli centralAjudaCli = db.CentralAjudaCli.Find(id); if (centralAjudaCli == null) { return(HttpNotFound()); } ViewBag.ClienteId = new SelectList(db.Clientes, "ClienteId", "Nome", centralAjudaCli.ClienteId); return(View(centralAjudaCli)); }