public ActionResult AboutUs(mvcTestingModel mvcModel) { mvcTestingDB mvcDB = new mvcTestingDB(); Session["Adminlogin"] = ""; try { mvcModel.CommentList = mvcDB.AllComments(); return View(mvcModel); } catch { return RedirectToAction("About", "Home"); } }
public ActionResult AboutUs(mvcTestingModel mvcModel, string str) { mvcTestingDB mvcDB = new mvcTestingDB(); try { string login = Session["login"].ToString(); if (login != "") { int result = 100; result = mvcDB.InsertCommnetsAboutUs(login, mvcModel.Comments.ComName, mvcModel.Comments.ComEMail, mvcModel.Comments.ComLocation, mvcModel.Comments.ComComments); if (result == 0) { ViewData["ValidInsert"] = "true"; //MailMessage mail = new MailMessage(); //mail.From = new MailAddress(mvcModel.Comments.ComEMail); //mail.To.Add("*****@*****.**"); //mail.Subject = "Message from Online Book Library!!"; //mail.Body = mvcModel.Comments.ComComments; //mail.IsBodyHtml = false; //SmtpClient smtp = new SmtpClient(); //smtp.DeliveryMethod = SmtpDeliveryMethod.Network; //smtp.Host = "smtp.gmail.com"; //smtp.Port = 587; //smtp.Credentials = new System.Net.NetworkCredential("*****@*****.**", "saurav1987"); //smtp.EnableSsl = true; //smtp.Send(mail); try { mvcModel.CommentList = mvcDB.AllComments(); } catch { ViewData["LoadComments"] = "false"; } } else { ViewData["ValidInsert"] = "false"; } } else { ViewData["login"] = "******"; } } catch { return RedirectToAction("About", "Home"); } return View(mvcModel); }