コード例 #1
0
 public void Update(ForumUpdateRequest model)
 {
     //Runs the stored proc to update a forum
     this.DataProvider.ExecuteNonQuery(
         "Forum_Update",
         inputParamMapper : delegate(SqlParameterCollection forumParamCol)
     {
         forumParamCol.AddWithValue("@Id", model.Id);
         forumParamCol.AddWithValue("@StatusId", model.StatusId);
         forumParamCol.AddWithValue("@ModifiedBy", model.ModifiedBy);
     }
         );
 }
コード例 #2
0
 public HttpResponseMessage Put(int id, ForumUpdateRequest model)
 {
     try
     {
         if (ModelState.IsValid)
         {
             model.ModifiedBy = _principal.Identity.GetCurrentUser().Name;
             //Updates the forum with the passed in id
             _service.Update(model);
             SuccessResponse resp = new SuccessResponse();
             return(Request.CreateResponse(HttpStatusCode.OK, resp));
         }
         else
         {
             return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ModelState));
         }
     }
     catch (System.Exception ex)
     {
         //Log any exception that occurs
         log.Error("Error updating forum id: " + id, ex);
         return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, ex.Message));
     }
 }