예제 #1
0
 public void AddTrails(AllTrails item)
 {
     using (IDbConnection dbConnection = Connection){
         string sql = $@"INSERT INTO trails(trail_name, description, length, elevation, latitude, longitude)VALUES(@trail_name, @description, @length, @elevation, @latitude, @longitude)";
         dbConnection.Open();
         dbConnection.Execute(sql, item);
     }
 }
예제 #2
0
 public IActionResult AddTrailtoDb(AllTrails trails)
 {
     if (ModelState.IsValid)
     {
         _dapperTrail.AddTrails(trails);
         return(RedirectToAction("Index"));
     }
     return(View("AddTrail"));
 }