// Update with Id public void Update(CommentsUpdateRequest model, int id, string userId) { DataProvider.ExecuteNonQuery(GetConnection, "dbo.Comments_Update" , inputParamMapper : delegate(SqlParameterCollection paramCollection) { paramCollection.AddWithValue("@EntityId", model.EntityId); paramCollection.AddWithValue("@ParentId", model.ParentId); paramCollection.AddWithValue("@TypeId", model.TypeId); paramCollection.AddWithValue("@Title", model.Title); paramCollection.AddWithValue("@Description", model.Description); paramCollection.AddWithValue("@CreatedBy", userId); paramCollection.AddWithValue("@CreatedDate", model.CreatedDate); paramCollection.AddWithValue("@ModifiedBy", userId); paramCollection.AddWithValue("@Id", id); }); }
public HttpResponseMessage Update(CommentsUpdateRequest model, int id) { string userId = _userService.GetCurrentUserId(); if (string.IsNullOrEmpty(userId)) { userId = "18c5d19c - 998a - 4c5f - be05 - 1a3fa116d278"; } if (!ModelState.IsValid || model == null) { return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState)); } ItemResponse <Comment> response = new ItemResponse <Comment>(); _commentService.Update(model, id, userId); return(Request.CreateResponse(HttpStatusCode.OK, response)); }