Esempio n. 1
0
        public ActionResult Create(Contactus_Tbl contactus_Tbl)
        {
            if (ModelState.IsValid)
            {
                MailMessage mm = new MailMessage("*****@*****.**", "*****@*****.**");
                mm.Subject    = "Covert-- ReplyTo:" + contactus_Tbl.Email;
                mm.Body       = contactus_Tbl.Name + ":\n" + contactus_Tbl.Message;
                mm.IsBodyHtml = false;



                SmtpClient smtp = new SmtpClient();
                smtp.Host      = "smtp.gmail.com";
                smtp.Port      = 587;
                smtp.EnableSsl = true;


                NetworkCredential nc = new NetworkCredential("*****@*****.**", "adminofcovert");
                smtp.UseDefaultCredentials = true;
                smtp.Credentials           = nc;
                smtp.Send(mm);

                db.Contactus_Tbl.Add(contactus_Tbl);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(contactus_Tbl));
        }
Esempio n. 2
0
        public ActionResult DeleteConfirmed(int id)
        {
            Contactus_Tbl contactus_Tbl = db.Contactus_Tbl.Find(id);

            db.Contactus_Tbl.Remove(contactus_Tbl);
            db.SaveChanges();
            ViewData["ED"] = "Successfully Deleted";
            return(View("Index", db.Contactus_Tbl.OrderByDescending(s => s.ContactId).ToList()));
        }
Esempio n. 3
0
        public ActionResult newsletter(string emailsss)
        {
            Contactus_Tbl contactus_Tbl = new Contactus_Tbl();

            if (emailsss != null)
            {
                contactus_Tbl.Email   = emailsss;
                contactus_Tbl.Name    = "Request";
                contactus_Tbl.Message = "Newsletter";
                db.Contactus_Tbl.Add(contactus_Tbl);
                db.SaveChanges();
            }
            return(RedirectToAction("index", "home"));
        }
 public ActionResult reportpost(int?id)
 {
     if (Session["id"] != null && id != null)
     {
         Contactus_Tbl cc = new Contactus_Tbl();
         cc.PostId  = id;
         cc.UserId  = Convert.ToInt32(Session["id"]);
         u          = db.Users_Tbl.Find(cc.UserId);
         cc.Email   = u.Email;
         p          = db.Posts_Tbl.Find(id);
         cc.Name    = u.Name + "\t reported \t" + p.PostName;
         cc.Message = "Post Reported:" + cc.PostId.ToString();
         db.Contactus_Tbl.Add(cc);
         db.SaveChanges();
     }
     return(View("Index", db.Posts_Tbl.Where(x => x.Status == "Approved").OrderByDescending(x => x.PostId).ToList().ToPagedList(1, 10)));
 }
Esempio n. 5
0
        // GET: Contactus_Tbl/Edit/5


        // GET: Contactus_Tbl/Delete/5
        public ActionResult Delete(int?id)
        {
            if (Session["id"] != null)
            {
                u = db.Users_Tbl.Find(Session["id"]);
                if (u.RollId == 1)
                {
                    if (id == null)
                    {
                        return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
                    }
                    Contactus_Tbl contactus_Tbl = db.Contactus_Tbl.Find(id);
                    if (contactus_Tbl == null)
                    {
                        return(HttpNotFound());
                    }
                    return(View(contactus_Tbl));
                }
                return(RedirectToAction("Index", "Home"));
            }
            return(RedirectToAction("Index", "Home"));
        }