Example #1
0
        public void UserRegister(Models.Introduction Introduction)
        {
            string sql = @" INSERT INTO Introduction (LocationName,IntroductionContents,Lat,Lon) VALUES (@LocationName,@IntroductionContents,@Lat,@Lon)";

            using (SqlConnection conn = new SqlConnection(this.GetDBConnectionString()))
            {
                conn.Open();
                SqlCommand cmd = new SqlCommand(sql, conn);
                cmd.Parameters.Add(new SqlParameter("@IntroductionContents", Introduction.IntroductionContents));
                cmd.Parameters.Add(new SqlParameter("@LocationName", Introduction.LocationName));
                cmd.Parameters.Add(new SqlParameter("@Lat", Introduction.Lat));
                cmd.Parameters.Add(new SqlParameter("@Lon", Introduction.Lon));
                cmd.ExecuteNonQuery();
                conn.Close();
            }
        }
 public ActionResult InsertLocation(Models.Introduction introduce)
 {
     Models.Introduce Introduce = new Models.Introduce();
     Introduce.UserRegister(introduce);
     return(RedirectToAction("../Introduction/InsertIndex"));
 }
 public ActionResult InsertIndex(Models.Introduction introduce)
 {
     return(View());
 }