Ejemplo n.º 1
0
        public int DeleteBlogFile(int blogId, IdRequest model)
        {
            int id = 0;

            DataProvider.ExecuteNonQuery(GetConnection, "dbo.BlogFiles_DeleteById",
                inputParamMapper: delegate(SqlParameterCollection paramCollection)
                {
                    paramCollection.AddWithValue("@BlogId", blogId);
                    paramCollection.AddWithValue("@FileId", model.Id);

                }, returnParameters: delegate(SqlParameterCollection param)
                {
                    int.TryParse(param["@FileId"].Value.ToString(), out id);
                }
            );

            return id;
        }
Ejemplo n.º 2
0
        public int InsertBlogFile(int blogId, IdRequest model, string userId)
        {
            int id = 0;

            DataProvider.ExecuteNonQuery(GetConnection, "dbo.BlogFiles_Insert",
                inputParamMapper: delegate(SqlParameterCollection paramCollection)
            {
                paramCollection.AddWithValue("@BlogId", blogId);
                paramCollection.AddWithValue("@FileId", model.Id);
                paramCollection.AddWithValue("@UserId", userId);

                SqlParameter b = new SqlParameter("@Id", System.Data.SqlDbType.Int);
                b.Direction = System.Data.ParameterDirection.Output;

                paramCollection.Add(b);

            }, returnParameters: delegate(SqlParameterCollection param)
            {
                int.TryParse(param["@Id"].Value.ToString(), out id);

            }
            );

            return id;
        }
        public HttpResponseMessage DeselectCoverPhoto(int blogId, IdRequest model)
        {
            ItemResponse<int> response = new ItemResponse<int>();

            response.Item = _blogService.DeleteBlogFile(blogId, model);

            return Request.CreateResponse(response);
        }
 public HttpResponseMessage BlogFile(int blogId, IdRequest model)
 {
     string userId = _userService.GetCurrentUserId();
     ItemResponse<int> response = new ItemResponse<int>();
     response.Item = _blogService.InsertBlogFile(blogId, model, userId);
     return Request.CreateResponse(response);
 }