Exemplo n.º 1
0
        public DiscussionFolderContract CreateFolder(DiscussionFolderContract contract)
        {
            // TODO
            PermissionContext.VerifyPermission(PermissionToken.Admin);

            return(repository.HandleTransaction(ctx => {
                var folder = new DiscussionFolder {
                    Name = contract.Name
                };

                ctx.Save(folder);

                ctx.AuditLogger.AuditLog("created " + folder);

                return new DiscussionFolderContract(folder, DiscussionFolderOptionalFields.None, userIconFactory);
            }));
        }
Exemplo n.º 2
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="contract"></param>
        /// <returns>DiscussionFolderContract</returns>
        public DiscussionFolderContract DiscussionApiPostNewFolder(DiscussionFolderContract contract)
        {
            // verify the required parameter 'contract' is set
            if (contract == null)
            {
                throw new ApiException(400, "Missing required parameter 'contract' when calling DiscussionApiPostNewFolder");
            }


            var path = "/api/discussions/folders";

            path = path.Replace("{format}", "json");

            var    queryParams  = new Dictionary <String, String>();
            var    headerParams = new Dictionary <String, String>();
            var    formParams   = new Dictionary <String, String>();
            var    fileParams   = new Dictionary <String, FileParameter>();
            String postBody     = null;

            postBody = ApiClient.Serialize(contract);                                     // http body (model) parameter

            // authentication setting, if any
            String[] authSettings = new String[] {  };

            // make the HTTP request
            IRestResponse response = (IRestResponse)ApiClient.CallApi(path, Method.POST, queryParams, postBody, headerParams, formParams, fileParams, authSettings);

            if (((int)response.StatusCode) >= 400)
            {
                throw new ApiException((int)response.StatusCode, "Error calling DiscussionApiPostNewFolder: " + response.Content, response.Content);
            }
            else if (((int)response.StatusCode) == 0)
            {
                throw new ApiException((int)response.StatusCode, "Error calling DiscussionApiPostNewFolder: " + response.ErrorMessage, response.ErrorMessage);
            }

            return((DiscussionFolderContract)ApiClient.Deserialize(response.Content, typeof(DiscussionFolderContract), response.Headers));
        }
Exemplo n.º 3
0
 public DiscussionFolderContract PostNewFolder(DiscussionFolderContract contract) => _queries.CreateFolder(contract);
Exemplo n.º 4
0
 public DiscussionFolderContract PostNewFolder(DiscussionFolderContract contract)
 {
     return(queries.CreateFolder(contract));
 }