public ActionResult contactus(MarketShare.Models.marketuser model) { DateTime dt = DateTime.Now; try { DB.user_feedback obj = new DB.user_feedback(); obj.name = model.name; obj.emailid = model.emailid; obj.contactno = model.contactno; obj.subject = model.subject; obj.message = model.message; obj.dateofmsg = dt; db.user_feedback.Add(obj); db.SaveChanges(); ViewBag.msg = "Successfully Submitted"; return(View()); } catch (Exception ex) { throw ex; } finally { ViewBag.msg = "Successfully Submitted"; ModelState.Clear(); } }
public ActionResult register(MarketShare.Models.marketuser model) { //validate captcha if (Session["Captcha"] == null || Session["Captcha"].ToString() != model.Captcha) { ModelState.AddModelError("Captcha", "Wrong value of sum, please try again."); //dispay error and generate a new captcha return(View(model)); } else { try { DB.user_master obj = new DB.user_master(); obj.name = model.name; obj.emailid = model.emailid; obj.password = model.password; obj.securityquestion = model.securityquestion; obj.answer = model.answer; db.user_master.Add(obj); db.SaveChanges(); return(View()); } catch (Exception ex) { throw ex; } finally { ViewBag.msg = "Successfully Submitted"; ModelState.Clear(); } } }
public ActionResult forgotpassword(MarketShare.Models.marketuser md) { var u = (from userlist in db.user_master where userlist.emailid == md.emailid && userlist.securityquestion == md.securityquestion && userlist.answer == md.answer select new { userlist.password }).ToList(); if (u.FirstOrDefault() != null) { ViewBag.msg = "Your Password is:" + u.FirstOrDefault().password; } else { ViewBag.msg = "Invalid input Credentials."; } return(View()); }
public ActionResult changepassword(MarketShare.Models.marketuser model) { // SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["democon"].ConnectionString); // con.Open(); // SqlCommand cmd = new SqlCommand("update user_master set password='******' where emailid='" + Session["emailid"] + "' and password='******'", con); // int i = cmd.ExecuteNonQuery(); // if (i > 0) // { // ViewBag.msg = "Password Changed Successfully"; // return View(model); // } // else // { // ViewBag.msg = "Invalid Information"; // return View(model); // } //} string uid = Session["emailid"].ToString(); var u = (from userlist in db.user_master where userlist.emailid == uid && userlist.password == model.password select new { userlist.emailid, userlist.password }).ToList(); if (u.FirstOrDefault() != null) { var cm = (from data in db.user_master where data.emailid == uid select data).FirstOrDefault(); cm.password = model.newpassword; db.SaveChanges(); ViewBag.msg = "Password Changed Successfully"; } else { ViewBag.msg = "Invalid Current Password."; } return(View(model)); }
public ActionResult login(MarketShare.Models.marketuser md) { var u = (from userlist in db.user_master where userlist.emailid == md.emailid && userlist.password == md.password select new { userlist.emailid, userlist.password, userlist.name }).ToList(); if (u.FirstOrDefault() != null) { Session["emailid"] = u.FirstOrDefault().emailid; Session["name"] = u.FirstOrDefault().name; return(RedirectToAction("userhome", "User")); } else { ViewBag.msg = "Invalid login Credentials."; } return(View()); }