public ActionResult Create([Bind(Include = "Id,Name,Email,Password")] Regst regst, string name, string email, string pass)
        {
            if (ModelState.IsValid)
            {
                regst.Name     = name;
                regst.Email    = email;
                regst.Password = pass;

                db.Regsts.Add(regst);
                if (regst != null)
                {
                    using (MailMessage mm = new MailMessage("*****@*****.**", regst.Email))
                    {
                        mm.Subject    = "AccountActivation";
                        mm.Body       = "Hello! " + regst.Name + " " + "you are successfully registered";
                        mm.IsBodyHtml = false;
                        SmtpClient smtp = new SmtpClient();
                        smtp.Host      = "smtp.gmail.com";
                        smtp.EnableSsl = true;
                        NetworkCredential network = new NetworkCredential("*****@*****.**", "sahayaraj");
                        smtp.UseDefaultCredentials = true;
                        smtp.Credentials           = network;
                        smtp.Port = 587;
                        smtp.Send(mm);
                    }
                }
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(regst));
        }
        public ActionResult DeleteConfirmed(int id)
        {
            Regst regst = db.Regsts.Find(id);

            db.Regsts.Remove(regst);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "Id,Name,Email,Password")] Regst regst)
 {
     if (ModelState.IsValid)
     {
         db.Entry(regst).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(regst));
 }
        // GET: Regsts/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Regst regst = db.Regsts.Find(id);

            if (regst == null)
            {
                return(HttpNotFound());
            }
            return(View(regst));
        }
        public ActionResult Login(Regst user, string email, string pass)
        {
            user.Email    = email;
            user.Password = pass;
            var obj = db.Regsts.ToList();
            var usr = obj.SingleOrDefault(u => u.Email == user.Email && u.Password == user.Password);

            if (usr != null)
            {
                Session["Id"]    = usr.Id.ToString();
                Session["Email"] = usr.Email.ToString();
                return(RedirectToAction("UserPage", "Home"));
            }
            else if (user.Email == "*****@*****.**" && user.Password == "admin123")
            {
                return(View("HomePage", "Home"));
            }

            return(View());
        }