public ActionResult Contact() { using (ModelDB db = new ModelDB()) { AllTables at = new AllTables(); at.lstKisi = db.Kisi.ToList(); at.secResim = db.Resimler.Where(x => x.resimNo == 1).FirstOrDefault(); at.lstKategoriler = db.Kategoriler.ToList(); at.lstBlog = db.Blog.ToList(); at.orderedDil = db.DilBilgi.OrderByDescending(x => x.yuzdesi).ToList(); return(View(at)); } }
public ActionResult deneyimBil() { if (Session["ActiveUser"] != null) { ViewBag.UserName = Session["ActiveUser"].ToString(); } else { return(RedirectToAction("login")); } ViewBag.UserName = Session["ActiveUser"].ToString(); using (ModelDB db = new ModelDB()) { AllTables at = new AllTables(); at.lstKisi = db.Kisi.ToList(); at.lstDeneyim = db.Deneyim.ToList(); return(View(at)); } }
public ActionResult Contact(FormCollection form) { try { if (ModelState.IsValid) { string name = form["ad"].ToString(); string email = form["email"].ToString(); string mesaj = form["mesaj"].ToString(); var senderEmail = new MailAddress("*****@*****.**", ""); var receivereEmail = new MailAddress("*****@*****.**", "Receiver"); var password = "******"; var body = mesaj; string content = "<html> <table border='1'> "; content += "<tr>"; content += "<th> Ad-Soyad </th> <td>" + name + "</td></tr>"; content += "<tr><th> Mail </th><td>" + email + "</td></tr>"; content += "<tr> <th> Mesaj </th><td>" + mesaj + "</td>"; content += "</tr>"; content += "</table> </html>"; var smtp = new SmtpClient { Host = "smtp.gmail.com", Port = 587, EnableSsl = true, DeliveryMethod = SmtpDeliveryMethod.Network, UseDefaultCredentials = false, Credentials = new NetworkCredential(senderEmail.Address, password) }; using (var mess = new MailMessage(senderEmail, receivereEmail) { Subject = "CV Maili", Body = content }) { mess.IsBodyHtml = true; smtp.Send(mess); } using (ModelDB db = new ModelDB()) { AllTables at = new AllTables(); at.lstKisi = db.Kisi.ToList(); at.lstKategoriler = db.Kategoriler.ToList(); at.lstBlog = db.Blog.ToList(); at.orderedDil = db.DilBilgi.OrderByDescending(x => x.yuzdesi).ToList(); return(View(at)); } } } catch (Exception) { ViewBag.Error = "Mail Gönderilirken bir problem yaşandı"; } using (ModelDB db = new ModelDB()) { AllTables at = new AllTables(); at.lstKisi = db.Kisi.ToList(); at.lstKategoriler = db.Kategoriler.ToList(); at.lstBlog = db.Blog.ToList(); at.orderedDil = db.DilBilgi.OrderByDescending(x => x.yuzdesi).ToList(); return(View(at)); } }