public HttpResponseMessage Put(int Id, OrganizerUpdateModel req) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } organizerService.Update(req); return(Request.CreateResponse(HttpStatusCode.OK)); }
public void Update(OrganizerUpdateModel model) { using (SqlConnection con = new SqlConnection(connectionString)) { con.Open(); SqlCommand cmd = con.CreateCommand(); cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "SongNames_Update"; cmd.Parameters.AddWithValue("@SongName", model.SongName); cmd.Parameters.AddWithValue("@Lyrics", model.Lyrics); cmd.Parameters.AddWithValue("@Id", model.Id); cmd.ExecuteNonQuery(); } }