public ActionResult fregister(aip.Models.faculty model) { SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["kiit"].ConnectionString); con.Open(); SqlCommand cmd = new SqlCommand("insert into faculty values('" + model.userid + "','" + model.pwd + "','" + model.name + "','" + model.email + "')", con); int i = cmd.ExecuteNonQuery(); if (i > 0) { ViewBag.msg = "REGISTER SUCCESS"; } return(View(model)); }
public ActionResult facultylogin(aip.Models.faculty model) { SqlConnection con = new SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings["kiit"].ConnectionString); con.Open(); SqlCommand cmd = new SqlCommand("Select * from faculty where userid='" + model.userid + "' and pwd='" + model.pwd + "'", con); SqlDataReader dr = cmd.ExecuteReader(); if (dr.Read()) { Session["userid"] = model.userid; return(RedirectToAction("facultyhome", "faculty")); } else { ViewBag.msg = "invalid info"; return(View(model)); } }