예제 #1
0
        public int Insert(NewsFeedCommentAddRequest model)
        {
            int returnValue = 0;

            DataProvider.ExecuteNonQuery("dbo.NewsFeedComment_Insert",
                                         inputParamMapper: (SqlParameterCollection inputs) =>
            {
                inputs.Add(SqlDbParameter.Instance.BuildParameter("@NewsFeedPostId", model.NewsFeedPostId, SqlDbType.Int));
                inputs.Add(SqlDbParameter.Instance.BuildParameter("@CommentText", model.CommentText, SqlDbType.NVarChar, 2000));
                inputs.Add(SqlDbParameter.Instance.BuildParameter("@CreatedById", model.CreatedById, SqlDbType.Int));
                inputs.Add(SqlDbParameter.Instance.BuildParameter("@Id", 0, SqlDbType.Int, paramDirection: ParameterDirection.Output));
            },
                                         returnParameters: (SqlParameterCollection inputs) =>
            {
                int.TryParse(inputs["@Id"].Value.ToString(), out returnValue);
            });
            return(returnValue);
        }
예제 #2
0
 public IHttpActionResult Post(NewsFeedCommentAddRequest model)
 {
     try
     {
         model.CreatedById = currentUserId;
         if (!ModelState.IsValid)
         {
             return(BadRequest(ModelState));
         }
         ItemResponse <int> response = new ItemResponse <int>
         {
             Item = _newsFeedCommentService.Insert(model)
         };
         return(Ok(response));
     }
     catch (Exception ex)
     {
         return(BadRequest(ex.Message));
     }
 }