public HttpResponseMessage Update(SceneUpdateRequest model) { if (!ModelState.IsValid) { return(Request.CreateResponse(HttpStatusCode.BadRequest, ModelState)); } SceneService.Update(model); SuccessResponse response = new SuccessResponse(); return(Request.CreateResponse(HttpStatusCode.OK, response)); }
public static void Update(SceneUpdateRequest model) { using (SqlConnection conn = new SqlConnection(WebConfigurationManager.ConnectionStrings["DefaultConnection"].ConnectionString)) { conn.Open(); using (SqlCommand cmd = new SqlCommand()) { cmd.Connection = conn; cmd.CommandType = System.Data.CommandType.StoredProcedure; cmd.CommandText = "dbo.Scene_Update"; MapCommonSceneParameters(model, cmd); cmd.Parameters.AddWithValue("@Id", model.Id); cmd.ExecuteNonQuery(); } conn.Close(); } }