public ActionResult messageviews() { SqlConnection con = new dbconnection().openconnection(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = "select * from [feedbacks]"; SqlDataReader dr = cmd.ExecuteReader(); List <rad.Models.home.feedbacks> mess = new List <rad.Models.home.feedbacks>(); if (dr.HasRows) { while (dr.Read()) { mess.Add(new home.feedbacks { message = dr["message"].ToString(), email = dr["email"].ToString(), feedbackid = int.Parse(dr["feedbackid"].ToString()) } ); Session["feedback"] = mess; } } return(View()); }
public ActionResult staffcheck(string idno) { SqlConnection con = new dbconnection().openconnection(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = "select * from [reservation] where identifynumber='" + idno + "' "; SqlDataReader dr = cmd.ExecuteReader(); List <rad.Models.result> rl = new List <rad.Models.result>(); if (dr.HasRows) { while (dr.Read()) { rl.Add(new result { firstname = dr["firstname"].ToString(), lastname = dr["lastname"].ToString(), checkin = (DateTime.Parse(dr["checkin"].ToString())).ToShortDateString(), checkout = (DateTime.Parse(dr["checkout"].ToString())).ToShortDateString(), roomid = int.Parse(dr["roomid"].ToString()), resrvationid = ((dr["reservationid"].ToString())) } ); } Session["table"] = rl; } else { Session["checkreservation "] = "sorry you are entered wrong details"; } return(RedirectToAction("dashboardother", "login")); }
public ActionResult feedback(string message, string email) { SqlConnection con = new dbconnection().openconnection(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = System.Data.CommandType.Text; cmd.CommandText = "insert into [feedbacks] (email,message) values('" + email + "','" + message + "')"; int a = cmd.ExecuteNonQuery(); if (a > 0) { Session["message"] = "Your message is Successfully sent"; } else { Session["message"] = "Sorry Your message is not sent"; } return(RedirectToAction("index", "home")); }