コード例 #1
0
        public async Task <BaseResponseDto <string> > CreateNewTemplate(NewTemplateRequestDto request)
        {
            var url = _properties.GetServiceUrl(_serviceUrlSettingKey);

            url = $"{url}/api/template";
            return(await Post <string>(url, request).ConfigureAwait(false));
        }
コード例 #2
0
        protected void btnOpenTemplatedProduct_Click(object sender, EventArgs e)
        {
            var masterTemplateID = CurrentDocument.GetStringValue("ProductChiliTemplateID", string.Empty);
            var workspaceID      = CurrentDocument.GetStringValue("ProductChiliWorkgroupID", string.Empty);
            var use3d            = CurrentDocument.GetBooleanValue("ProductChili3dEnabled", false);
            var resource         = new KenticoResourceService();
            var client           = DIContainer.Resolve <ITemplatedClient>();
            var requestBody      = new NewTemplateRequestDto
            {
                User          = MembershipContext.AuthenticatedUser.UserID.ToString(),
                TemplateId    = masterTemplateID,
                WorkSpaceId   = workspaceID,
                UseHtmlEditor = false,
                Use3d         = use3d
            };
            var newTemplateUrl = client.CreateNewTemplate(requestBody).Result?.Payload;

            if (!string.IsNullOrEmpty(newTemplateUrl))
            {
                var uri            = new Uri(newTemplateUrl);
                var newTemplateID  = HttpUtility.ParseQueryString(uri.Query).Get("doc");
                var destinationUrl = string.Format("{0}?nodeId={1}&templateId={2}&workspaceid={3}&use3d={4}",
                                                   ProductEditorUrl,
                                                   DocumentContext.CurrentDocument.NodeID,
                                                   newTemplateID,
                                                   workspaceID,
                                                   use3d);

                var productTypes = DocumentContext.CurrentDocument.GetValue("ProductType").ToString().Split('|').ToLookup(s => s);
                if (productTypes.Contains(ProductTypes.MailingProduct) && productTypes.Contains(ProductTypes.TemplatedProduct))
                {
                    var selectMailingList = URLHelper.AddParameterToUrl(SelectMailingListUrl, "url", URLHelper.URLEncode(destinationUrl));
                    Response.Redirect(selectMailingList);
                }
                else
                {
                    Response.Redirect(destinationUrl);
                }
            }
            else
            {
                btnOpenTemplatedProduct.Attributes.Clear();
                btnOpenTemplatedProduct.Attributes.Add("class", "btn-action btn-action input--error");
                spanErrorMessage.Visible = true;
            }
        }