Пример #1
0
        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));
        }
Пример #2
0
        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();
            }
        }