public int Update(BlogPageUpdateRequest model) { DataProvider.ExecuteNonQuery(GetConnection, "dbo.Blogs_UpdateByID", inputParamMapper: (Action<SqlParameterCollection>)delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@Title", model.Title); paramCollection.AddWithValue("@Content", model.Content); paramCollection.AddWithValue("@MetaData", model.MetaData); paramCollection.AddWithValue("@PathName", model.PathName); paramCollection.AddWithValue("@LiveDate", model.LiveDate); paramCollection.AddWithValue("@Status", model.Status); paramCollection.AddWithValue("@ID", model.ID); //paramCollection.AddWithValue("@Preview", model.Preview); AddTags(model.Tags, paramCollection); }, returnParameters: delegate(SqlParameterCollection param) { } ); return model.ID; }
public HttpResponseMessage UpdateBlogPost(BlogPageUpdateRequest model) { List<int> newTags = null; if (!ModelState.IsValid) { return Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState); } if (model.NewTags != null && model.NewTags.Any()) { newTags = new List<int>(); newTags = TagsService.AddMultiple(model.NewTags, true); foreach (var item in newTags) { model.Tags.Add(item); } } ItemResponse<Int32> response = new ItemResponse<Int32>(); response.Item = _blogService.Update(model); return Request.CreateResponse(response); }