public void Update(WikiUpdateRequest model, string userId) { DataProvider.ExecuteNonQuery(GetConnection, "dbo.WikiPages_Update", inputParamMapper : delegate(SqlParameterCollection updateWikis) { updateWikis.AddWithValue("@LastModifiedByUserId", userId); updateWikis.AddWithValue("@Id", model.Id); updateWikis.AddWithValue("@Name", model.Title); updateWikis.AddWithValue("@URL", model.URL); updateWikis.AddWithValue("@PublishDate", null); // model.PublishDate); updateWikis.AddWithValue("@Language", null); // model.Language); updateWikis.AddWithValue("@ParentId", model.ParentId); }); DataProvider.ExecuteNonQuery(GetConnection, "dbo.WikiPageSpaces_Delete" , inputParamMapper : delegate(SqlParameterCollection parameterCollection) { parameterCollection.AddWithValue("@WikiPageId", model.Id); }); //if (model.WikiSpaceIds != null) //{ // foreach (var wikiSpaceId in model.WikiSpaceIds) // DataProvider.ExecuteNonQuery(GetConnection, "dbo.WikiPageSpaces_Insert" // , inputParamMapper: delegate (SqlParameterCollection param) // { // param.AddWithValue("@WikiPageId", model.Id); // param.AddWithValue("@WikiSpaceId", wikiSpaceId); // }); //} }
public HttpResponseMessage Put(WikiUpdateRequest model, int id) { if (!ModelState.IsValid) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } string userId = UserService.GetCurrentUserId(); SucessResponse response = new SucessResponse(); _wikiService.Update(model, userId); return(Request.CreateResponse(response)); }