public async Task <int> AddUpdatePublish([FromBody] WebBuilderInfo objWebBuilderInfo) { WebBuilderController webBuilderController = new WebBuilderController(_memoryCache); objWebBuilderInfo.UserName = GetUsername; return(await webBuilderController.AddUpdatePublished(objWebBuilderInfo, CurrentHostEnvironment.WebRootPath)); }
public async Task <WebbuilderViewInfo> ShowData(bool isPreview) { WebBuilderController objWebController = new WebBuilderController(); WebbuilderViewGetInfo webbuilderViewGetInfo = new WebbuilderViewGetInfo() { Culture = GetCurrentCulture, PageName = PageName_, PreviewMode = isPreview }; ReuseableParams objReuseableParams = GetReuseableParams(_memoryCache); WebbuilderViewInfo webbuilderViewInfo = await objWebController.GetPageViewDOM(webbuilderViewGetInfo, objReuseableParams, GetSiteID); if (webbuilderViewInfo != null) { webbuilderViewInfo.PageName = PageName_; webbuilderViewInfo.HostURL = HostUrl; webbuilderViewInfo.PreviewMode = isPreview; CommonCbuilder commonCbuilder = new CommonCbuilder(); Task loadComponents = GetComponent(!isPreview); Task loadpackages = CombinePackagejs(); Task loadlibraries = commonCbuilder.CombineWebbuilderLibrary("*-view.js", "webbuilderView.js"); await Task.WhenAll(loadComponents, loadpackages, loadlibraries); } AddJS("packagesjs", FolderName.CbuilderAssets + "/js/packages.js"); return(webbuilderViewInfo); }
public object GetRowOnlineComponents([FromBody] OnlineApiInfo onlineApiInfo) { SettingHelper settingHelper = new SettingHelper(_memoryCache); string version = settingHelper.GetCachedSettingValue(SettingKeys.Cbuilderversion); WebBuilderController objController = new WebBuilderController(_memoryCache); return(objController.GetRowOnlineComponents(onlineApiInfo.Offset, onlineApiInfo.Limit, onlineApiInfo.SearchText, onlineApiInfo.Type, onlineApiInfo.Category, onlineApiInfo.ApplicationName, secureToken, GetUsername, version)); }
public object ApplyDesign([FromBody] DesignParam designParam) { //SettingHelper settingHelper = new SettingHelper(_memoryCache); //string version = settingHelper.GetCachedSettingValue(SettingKeys.Cbuilderversion); WebBuilderController objController = new WebBuilderController(_memoryCache); return(objController.ApplyDesign(designParam.Param)); }
public object GetOnlineSites([FromBody] OnlineApiInfo onlineApiInfo) { SettingHelper settingHelper = new SettingHelper(_memoryCache); string version = settingHelper.GetCachedSettingValue(SettingKeys.Cbuilderversion); WebBuilderController objController = new WebBuilderController(_memoryCache); return(objController.GetOnlineSites(onlineApiInfo.Offset, onlineApiInfo.Limit, onlineApiInfo.ThemeName, onlineApiInfo.SectorID, onlineApiInfo.SiteCategoryID, onlineApiInfo.BusinessTypeID, onlineApiInfo.ApplicationName, secureToken, GetUsername, version)); }
private void ShowData() { WebBuilderController objWebController = new WebBuilderController(); WebBuilderInfo objWebInfo = new WebBuilderInfo(); objWebInfo.Culture = GetCurrentCultureName; objWebInfo.PortalID = GetPortalID; objWebInfo.UserModuleID = int.Parse(SageUserModuleID); objWebInfo.PageName = tempPageName; if (isPreview && GetUsername != ApplicationKeys.anonymousUser) { objWebInfo = objWebController.GetViewDOMByID(objWebInfo); } else { objWebInfo = objWebController.GetPublishedViewDOMByID(objWebInfo); } if (objWebInfo != null) { string data = string.Empty; settings = HttpUtility.HtmlEncode(objWebInfo.Settings); if (tempPageName.ToLower() != underConstruction.ToLower()) { if (enableHeader) { data += "<div class='editor-site-header'>"; if (objWebInfo.Header != null) { data += HttpUtility.HtmlDecode(objWebInfo.Header.Replace("fakeHostURL", GetHostURL())); } else { } data += "</div>"; } } data += "<div class='editor-componentWrapper'>"; if (objWebInfo.ViewDOM != null) { data += HttpUtility.HtmlDecode(objWebInfo.ViewDOM.Replace("fakeHostURL", GetHostURL())); } data += "</div>"; if (tempPageName.ToLower() != underConstruction.ToLower()) { data += "<div class='editor-site-footer'>"; if (objWebInfo.Footer != null) { data += HttpUtility.HtmlDecode(objWebInfo.Footer.Replace("fakeHostURL", GetHostURL())); } data += "</div>"; } ltrWebBuilderData.Text = data; } }
public object DownloadComponent([FromBody] BuilderComponent objBuilComponent) { SettingHelper settingHelper = new SettingHelper(_memoryCache); string version = settingHelper.GetCachedSettingValue(SettingKeys.Cbuilderversion); WebBuilderController cont = new WebBuilderController(_memoryCache); var resultobj = cont.InstallComponent(objBuilComponent.ComponentID, objBuilComponent.DownloadType, objBuilComponent.Version, GetUsername, objBuilComponent.SecureToken, version); WBCachehelper wBCachehelper = new WBCachehelper(_appLifetime); wBCachehelper.RemoveAllCachedFile(_webHostEnvironment); wBCachehelper.RecycleApplicationPool(); return(resultobj); }
public async Task <CbuilderView> LoadData() { WebBuilderController objWebController = new WebBuilderController(_memoryCache); WebBuilderInfo objWebInfo = new WebBuilderInfo { Culture = GetCurrentCulture, PageName = PageName, SiteID = GetSiteID }; return(await objWebController.GetEditDOMByID(objWebInfo, objReuseableParams, LocalizationEnabled)); }
public object GetOnlineThemeFile([FromBody] ThemeDetail themeDetail) { SettingHelper settingHelper = new SettingHelper(_memoryCache); string version = settingHelper.GetCachedSettingValue(SettingKeys.Cbuilderversion); WebBuilderController objController = new WebBuilderController(_memoryCache); object returnVaue = objController.GetOnlineTheme(themeDetail.ThemeID, GetUsername, secureToken, version); WBCachehelper wBCachehelper = new WBCachehelper(_appLifetime); wBCachehelper.RemoveAllCachedFile(_webHostEnvironment); wBCachehelper.RecycleApplicationPool(); return(returnVaue); }
public async Task <int> EnableHeadFoot([FromBody] HeaderFooter headerFooter) { try { WebBuilderController webBuilderController = new WebBuilderController(_memoryCache); return(await webBuilderController.EnableHeadFoot(headerFooter)); } catch (Exception ex) { ProcessException(ex); return(0); } }
private void GetComponent() { string componentPath = Server.MapPath(@"~\Modules\WebBuilder\js\components.js"); if (!File.Exists(componentPath)) { int userModuleID = 1317; WebBuilderController objWebbuilderController = new WebBuilderController(); List <BuilderComponentJson> objComponentList = objWebbuilderController.GetComponentValue(userModuleID.ToString()); componentList = JsonConvert.SerializeObject(objComponentList); //this.Page.ClientScript.RegisterStartupScript(this.GetType(), "StartupViewScript", "var storedComponent=" + componentList.ToString(), true); SaveComponentToJS("var storedComponent=" + componentList.ToString() + ";", componentPath); } }
private async Task GetComponent(bool isPublished) { string compoFileName = (isPublished ? "components_pub_" + PageName_.ToLower() : "components_" + PageName_.ToLower()) + ".js"; string compoFilePath = Path.Combine(FolderName.CbuilderAssets, "js", "PageComponent", compoFileName); string compoFileAbsPath = Path.Combine(CurrentHostEnvironment.WebRootPath, compoFilePath); if (!System.IO.File.Exists(compoFileAbsPath) || CurrentHostEnvironment.IsDevelopment) { WebBuilderController objWebbuilderController = new WebBuilderController(); var objComponentList = await objWebbuilderController.GetComponentViewValue(PageName_, isPublished, GetSiteID); string componentList = JsonSerializer.Serialize(objComponentList); await SaveComponentToJS("var storedComponent=" + componentList + ";", compoFileAbsPath); } string componentversion = settingValues?[SettingKeys.ComponentVersion]; AddJS("webbuilderPagecomponentJs", compoFilePath.Replace("\\", "/") + "?v=" + componentversion); }
private void SaveComponentToJS(string componentPath) { try { string componentList = string.Empty; WebBuilderController objWebbuilderController = new WebBuilderController(); List <BuilderComponentJson> objComponentList = objWebbuilderController.GetComponentValue(userModuleID.ToString()); componentList = JsonConvert.SerializeObject(objComponentList); string components = "var storedComponent=" + componentList.ToString() + ";"; File.WriteAllText(componentPath, String.Empty); using (StreamWriter writeToFile = new StreamWriter(File.Open(componentPath, FileMode.OpenOrCreate))) { writeToFile.WriteLine(components); } } catch (Exception ex) { ProcessException(ex); } }
public async Task <IViewComponentResult> InvokeAsync() { string imageURL = HttpContextCommons.HostURL + "/images/logos/dashboard/Contentder.jpg"; string dashboardImageFolder = Path.Combine(CurrentHostEnvironment.WebRootPath, "images", "logos", "dashboard"); if (Directory.Exists(dashboardImageFolder) && Directory.GetFiles(dashboardImageFolder).Length > 0) { string imagePath = Directory.GetFiles(dashboardImageFolder)[0]; imagePath = imagePath.Replace(CurrentHostEnvironment.WebRootPath, string.Empty).Replace("\\", "/"); imageURL = HttpContextCommons.HostURL + imagePath; } if (HttpContextCommons.LocalizationEnabled) { WebBuilderController webBuilderController = new WebBuilderController(); ViewBag.Languages = await webBuilderController.GetLanguageLists(SiteID); SettingHelper settingHelper = new SettingHelper(_memoryCache); ViewBag.DefaultLanguage = settingHelper.GetCachedSettingValue(SettingKeys.CultureLanguage); } ViewBag.DropdownURL = HostUrl + "/dashboard/" + PageName + "/" + ActionName + "/"; ViewBag.ImageURL = imageURL; return(await Task.FromResult((IViewComponentResult)View("Default"))); }
protected void btnExtractSite_Click(object sender, EventArgs e) { //check all the packages in this site //Read the extractor sp //execute the sp and save to the respective file //make zip of the packages //extract site json file //create temporary folder and then make zip of all the file ///declaring paths string destZip = "temptemplatezip"; string tempPackageFilePath = Server.MapPath(@"~\temptemplatefiles"); string tempZipFolderPath = Server.MapPath(@"~\" + destZip); string fullpath = Server.MapPath(@"~\ContentderPackages"); //create temporary folder for file collection if (Directory.Exists(tempPackageFilePath)) { Directory.Delete(tempPackageFilePath, true); } Directory.CreateDirectory(tempPackageFilePath); WebBuilderController objController = new WebBuilderController(); if (Directory.Exists(fullpath)) { string[] directories = Directory.GetDirectories(fullpath); int directoryLength = directories.Length; List <EasyPackage> objPackage = new List <EasyPackage>(); if (directoryLength > 0) { for (int i = 0; i < directoryLength; i++) { EasyPackage objPack = new EasyPackage(); DirectoryInfo dir = new DirectoryInfo(directories[i]); Dictionary <string, string> paramKeysValues = new Dictionary <string, string>(); objPack.Name = dir.Name; string xmlPath = directories[i] + "\\package.xml"; if (File.Exists(xmlPath)) { XmlDocument doc = SageFrame.Templating.xmlparser.XmlHelper.LoadXMLDocument(xmlPath); XmlNode node = doc.SelectSingleNode("package/datasql/sql"); if (node != null) { objPack.Sql = node.InnerText; } node = doc.SelectSingleNode("package/datasql/storeprocedure"); if (node != null) { objPack.Storeprocedure = node.InnerText; } node = doc.SelectSingleNode("package/datasql/params"); if (node != null) { XmlNodeList xnList = doc.SelectNodes("package/datasql/params/param"); foreach (XmlNode xn in xnList) { string key = xn["key"].InnerText; string value = xn["value"].InnerText; if (key.Trim() != string.Empty) { paramKeysValues.Add(key.Trim(), value.Trim()); } } } objPack.ParamkeyAndValue = paramKeysValues; objPackage.Add(objPack); } } objPackage = objController.ExtractPackageData(objPackage); //writing the data in respective sql file foreach (EasyPackage item in objPackage) { string spSavePath = Server.MapPath(@"~\ContentderPackages\" + item.Name + "\\sql\\" + item.Sql + ".sql"); if (!File.Exists(spSavePath)) { File.Create(spSavePath); } using (StreamWriter writetext = new StreamWriter(spSavePath)) { writetext.WriteLine(item.Result); } } //copy packages to temp folder DirectoryInfo tempDir = new DirectoryInfo(tempPackageFilePath + "\\ContentderPackages"); DirectoryInfo packageDir = new DirectoryInfo(fullpath); IOHelper.CopyDirectory(packageDir, tempDir); } } //read json from database for site WebbuilderSite objWebsite = new WebbuilderSite(); objWebsite = objController.ExtractSite(userModuleID, GetCurrentCulture(), GetHostURL()); objWebsite.Culture = GetCurrentCulture(); string jsonFile = JsonConvert.SerializeObject(objWebsite); //write extracted site json to file and save inside temporary folder string saveJson = tempPackageFilePath + "\\theme.json"; using (StreamWriter writetext = new StreamWriter(saveJson)) { writetext.WriteLine(jsonFile); } //Create zip folder if (!Directory.Exists(tempZipFolderPath)) { Directory.CreateDirectory(tempZipFolderPath); } //zip files inside the zip folder tempPackageFilePath += "\\"; tempZipFolderPath += "\\Contentder.zip"; destZip += "/Contentder.zip"; ZipUtil.ZipFiles(tempPackageFilePath, tempZipFolderPath, string.Empty); if (destZip != string.Empty) { //download zip //Response.Redirect(GetHostURL() + "/" + destZip); ////delete the temporary package and zip folder //IOHelper.DeleteDirectory(tempPackageFilePath); //IOHelper.DeleteDirectory(tempZipFolderPath); Response.Clear(); Response.AddHeader("Content-Disposition", "attachment; filename=Contentder.zip"); Response.ContentType = "application/x-zip-compressed"; Response.WriteFile(tempZipFolderPath); IOHelper.DeleteDirectory(tempPackageFilePath); IOHelper.DeleteDirectory(tempZipFolderPath); Response.Flush(); Response.End(); } }
public async Task <int> UpdateComponents([FromBody] BuilderComponent builderComponent) { WebBuilderController objController = new WebBuilderController(_memoryCache); return(await objController.UpdateComponents(builderComponent)); }
public object GetCompTemplateTags([FromBody] OnlineApiInfo onlineApiInfo) { WebBuilderController objController = new WebBuilderController(_memoryCache); return(objController.GetCompTemplateTags(onlineApiInfo.ComponentName, secureToken, GetUsername)); }
private void ShowData() { WebBuilderController objWebController = new WebBuilderController(); WebBuilderInfo objWebInfo = new WebBuilderInfo(); objWebInfo.Culture = GetCurrentCultureName; objWebInfo.PortalID = GetPortalID; objWebInfo.UserModuleID = userModuleID; objWebInfo.PageName = tempPageName; objWebInfo = objWebController.GetEditDOMByID(objWebInfo); if (objWebInfo != null) { string data = string.Empty; settings = HttpUtility.HtmlEncode(objWebInfo.Settings); if (enableHeader == "true") { data = "<div class='editor-site-header clearfix'>"; if (objWebInfo.HeaderEdit != null) { data += HttpUtility.HtmlDecode(objWebInfo.HeaderEdit.Replace("fakeHostURL", GetHostURL())); } data += "</div>"; } data += "<div class='editor-componentWrapper clearfix'>"; if (objWebInfo.EditDOM != null) { data += HttpUtility.HtmlDecode(objWebInfo.EditDOM.Replace("fakeHostURL", GetHostURL())); } data += "</div>"; if (tempPageName.ToLower() != underConstruction.ToLower()) { data += "<div class='editor-site-footer'>"; if (objWebInfo.FooterEdit != null) { data += HttpUtility.HtmlDecode(objWebInfo.FooterEdit.Replace("fakeHostURL", GetHostURL())); } data += "</div>"; } ltrWebBuilderData.Text = data; } //list all the pages here List <WebBuilderPages> objPageList = objWebController.GetPageList(GetPortalID); StringBuilder html = new StringBuilder(); bool pageNotExists = true; foreach (WebBuilderPages objPages in objPageList) { string pageName = objPages.PageName.Replace(" ", "-").Replace("&", "-and-"); if (tempPageName.Replace(" ", "-").ToLower() == pageName.ToLower()) { pageNotExists = false; } if (AllowedPage(pageName)) { html.Append("<li data-pageid='"); html.Append(objPages.PageID); html.Append("' data-webbuilderid='"); html.Append(objPages.WebbuilderID); html.Append("'>"); html.Append("<a href="); html.Append(GetHostURL()); html.Append("/"); html.Append(pageName); html.Append(" class='pagelink'><span class='pageName editor-text-letterSpacing-0' style='font-size: 14px; color: rgb(217, 217, 217);'>"); html.Append(objPages.PageName); html.Append("</span></a>"); html.Append("</li>"); } } if (pageNotExists) { Response.Redirect(GetHostURL() + "/Webbuilder/" + PortalDefaultPage); } ltrPageList.Text = html.ToString(); }
public async Task <IActionResult> Login(LoginViewModel model) { WebBuilderController webBuilderController = new WebBuilderController(); IList <ControllerDetail> controllerDetails = await webBuilderController.GetMethodDetails("login", GetSiteID); MethodInvoke methodInvoke = new MethodInvoke(); //if (controllerDetails?.Count > 0) // methodInvoke.Execute(controllerDetails[0], GetReuseableParams(_memoryCache), new List<ControllerDetail>()); string _loginTryCount = string.Format("loginTryCount{0}", model.UserEmail); await HttpContext.SignOutAsync(IdentityConstants.ExternalScheme); string loginError = "/login" + CultureURL + "?ReturnUrl=" + model.ReturnURL; if (ModelState.IsValid) { int tryCount = 1; string tryCountStr = TempData[_loginTryCount]?.ToString(); if (tryCountStr != null) { tryCount = int.Parse(tryCountStr) + 1; } //process for lockout if (tryCount >= 10) { OperationStatus rs = new OperationStatus() { Message = "Account locked out" }; if (tryCount == 10) { var lockout = new { UserName = model.UserEmail, }; rs = await _apiClient.PostAsync <OperationStatus>(lockout, APIURL.IdentityBaseUri + IdentityAPI.Account.LockOutAccount, true, false); } TempData[_loginTryCount] = tryCount; ActionMessage(rs.Message, MessageType.Error); return(Redirect(loginError)); } if (tryCount >= 3) // process for captcha { SettingHelper settingHelper = new SettingHelper(); Dictionary <string, string> settingValues = settingHelper.GetSettingValuesByKeys(string.Format("{0},{1}", SettingKeys.CaptchaServer, SettingKeys.CaptchaType)); loginError += "&captcha=true&type=" + settingValues[SettingKeys.CaptchaType]; if (tryCount > 3) { _captchaServer = settingValues[SettingKeys.CaptchaServer]; var rs = await ValidateCaptcha(model.cbuildercaptcharesponse, model.CaptchaAnswer); if (!rs.IsSuccess) { ActionMessage(rs.Message, MessageType.Error); return(Redirect(loginError)); } } } var obj = new { username = model.UserEmail, password = model.UserPassword }; //UserAuthenticateResponse userAuth = await _apiClient.PostAsync<UserAuthenticateResponse>(obj, APIURL.IdentityBaseUri + IdentityAPI.Account.PasswordSignInAsync, true, false); UserAuthenticateResponse userAuth = new UserAuthenticateResponse() { IsAuthenticate = true, AccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJodHRwOi8vc2NoZW1hcy54bWxzb2FwLm9yZy93cy8yMDA1LzA1L2lkZW50aXR5L2NsYWltcy9oYXNoIjoiNTc0M2MxMDMtNTIwOS00ZGU1LTgwODAtYmI5MDQxM2JjNzIwIiwibmFtZWlkIjoiMDJDMTU3RUQtQzg4MS00N0VGLUFENEQtQUQyMDIzQzJFNzA0IiwidW5pcXVlX25hbWUiOiJzdXBlcnVzZXJAY29udGVudGRlci5jb20iLCJncm91cHNpZCI6IjE2MCIsInJvbGUiOiJTdXBlciBBZG1pbiIsIm5iZiI6MTYwMjIzNzI0MSwiZXhwIjoxNjAyMjQwODQxLCJpYXQiOjE2MDIyMzcyNDEsImlzcyI6IkNJZGVudGl0eVNlcnZlciJ9.Kg7GQmeQl5us8RXl66h6nccxMatXMI95H4meIMZ9_-0", RefreshToken = "45dbb014bedf499897b0d0575ded96ac", UsersRoles = "Super Admin", UserID = "02C157ED-C881-47EF-AD4D-AD2023C2E704", Message = "Authenticated Successfully." }; if (userAuth == null) { ActionMessage("Identity server not working", MessageType.Warning); return(Redirect(loginError)); } else if (userAuth.IsAuthenticate) { if (string.IsNullOrEmpty(model.ReturnURL)) { RoleManager _role = new RoleManager(); model.ReturnURL = await _role.GetRoleRedirectURL(userAuth.UsersRoles, GetSiteID); if (model.ReturnURL == null) { model.ReturnURL = "/dashboard/dashboard/index" + CultureURL; } else { model.ReturnURL = model.ReturnURL + CultureURL; } } await AuthenticateUser(userAuth, model.ReturnURL); TempData[_loginTryCount] = 0; if (controllerDetails?.Count > 0) { var reusableParam = GetReuseableParams(_memoryCache); reusableParam.UserName = model.UserEmail; foreach (var item in controllerDetails) { methodInvoke.Execute(item, GetAPIParams(model.UserEmail, userAuth.UsersRoles), new List <ControllerDetail>()); } } return(Redirect(model.ReturnURL)); } else { TempData[_loginTryCount] = tryCount; ActionMessage(userAuth.Message, MessageType.Warning); return(Redirect(loginError)); } } ShowModelStateErorr(); return(Redirect(loginError)); }
public async Task <IActionResult> Index() { AddJS("robotsJS", "/admin/js/robots.js"); string robotPath = Path.Combine(CurrentHostEnvironment.ContentRootPath, "robots.txt"); Robots robots = new Robots(); if (System.IO.File.Exists(robotPath)) { using StreamReader sr = new StreamReader(robotPath); string contents = await sr.ReadToEndAsync(); if (contents.Length > 0) { string line1 = System.IO.File.ReadLines(robotPath)?.First(); switch (line1) { case "": ActionMessage("no file type of robot.txt", MessageType.Error); return(new EmptyResult()); case "#full": { robots.FileType = "full"; using StreamReader readFrom = new StreamReader(robotPath); robots.FullText = await readFrom.ReadToEndAsync(); robots.FullText = robots.FullText.Replace("#full", string.Empty); } break; case "#partial": { List <string> disallowedList = new List <string>(); robots.FileType = "partial"; using StreamReader readFrom = new StreamReader(robotPath); while (!readFrom.EndOfStream) { string line = await readFrom.ReadLineAsync(); if (line.StartsWith("Disallow:")) { disallowedList.Add(line.Replace("Disallow:", string.Empty).Trim()); } else if (line.StartsWith("User-Agent:")) { robots.UserAgent = line.Replace("User-Agent:", string.Empty).Trim(); } } robots.Disallowed = string.Join(",", disallowedList); robots.DisallowedList = disallowedList; WebBuilderController webBuilderController = new WebBuilderController(); ViewBag.Pages = await webBuilderController.GetAllPageList(GetSiteID); } break; default: ActionMessage("Robots.txt doesnot mathc any criteria", MessageType.Error); return(new EmptyResult()); } } else { ActionMessage("Robots.txt file is empty", MessageType.Error); return(new EmptyResult()); } } else { ActionMessage("Robots.txt file not found", MessageType.Error); return(new EmptyResult()); } return(View(robots)); }
public async Task <OperationStatus> Savepage([FromBody] WebbuilderPage webbuilderPage) { OperationStatus operationStatus = new OperationStatus(); string pageid = string.Empty; if (ModelState.IsValid) { WebBuilderController webBuilderController = new WebBuilderController(_memoryCache); int pageExists = await webBuilderController.CheckPage(webbuilderPage.PageName, webbuilderPage.PageID, GetSiteID); switch (pageExists) { case -1: operationStatus.StatusCode = Cbuilder.Core.API.Enum.StatusCode.DuplicateItem; operationStatus.Message = "PageName already exists"; operationStatus.Result = new string[] { "0", webbuilderPage.WebBuilderID.ToString() }; break ; case -2: operationStatus.StatusCode = Cbuilder.Core.API.Enum.StatusCode.Unauthorized; operationStatus.Message = "This page is system reserve page"; operationStatus.Result = new string[] { "0", webbuilderPage.WebBuilderID.ToString() }; break; case 0: pageid = await CreatePage(webbuilderPage); Guid.TryParse(pageid, out Guid _pageid); if (webbuilderPage.PageID == _pageid) { int rowseffected = await webBuilderController.UpdatePageName(webbuilderPage.PageName, webbuilderPage.WebBuilderID, webbuilderPage.CloneWebBuilderID, webbuilderPage.Culture); operationStatus.StatusCode = Cbuilder.Core.API.Enum.StatusCode.Updated; operationStatus.Result = new string[] { webbuilderPage.PageID.ToString(), webbuilderPage.WebBuilderID.ToString() }; } if (webbuilderPage.Mode == "A") { WebBuilderInfo webBuilderInfo = new WebBuilderInfo { CloneWebBuilderID = webbuilderPage.CloneWebBuilderID, PageComponent = webbuilderPage.PageComponent, HeaderFooterComponent = webbuilderPage.HeaderFooterComponent, PageName = webbuilderPage.PageName, Culture = webbuilderPage.Culture }; int webBuilderID = await webBuilderController.AddUpdate(webBuilderInfo, CurrentHostEnvironment.WebRootPath); operationStatus.StatusCode = Cbuilder.Core.API.Enum.StatusCode.Created; operationStatus.Result = new string[] { _pageid.ToString(), webBuilderID.ToString() }; } break; default: break; } //SEOController seocontroller = new SEOController(); //seocontroller.SaveSEOMetaTag(pageID, objTagValue, portalID, userName); //WebBuilderController webBuilderController = new WebBuilderController(_memoryCache); //objWebBuilderInfo.UserName = GetUsername; //objWebBuilderInfo.Extra = ""; } return(operationStatus); }
public async Task <IActionResult> Register(RegisterViewModel model) { //model.ReturnURL = string.IsNullOrEmpty(model.ReturnURL) ? "/login" + CultureURL : model.ReturnURL; string RegistrationURL = "/register" + CultureURL; OperationStatus status = new OperationStatus(); if (ModelState.IsValid) { SettingHelper settingHelper = new SettingHelper(); Dictionary <string, string> settingValues = settingHelper.GetSettingValuesByKeys(UserSettingKeys.GetAllKeys); bool CaptchaEnabled = settingValues[UserSettingKeys.Captcha] == "true"; if (CaptchaEnabled) { _captchaServer = settingValues[UserSettingKeys.CaptchaServer]; var res = await ValidateCaptcha(model.Cbuildercaptcharesponse, model.Captcha); if (!res.IsSuccess) { ActionMessage(res.Message, MessageType.Error); return(Redirect(RegistrationURL)); } } string roleName = settingValues[UserSettingKeys.RegistrationRoleID]; UserPostViewModel user = new UserPostViewModel(); string method = APIURL.IdentityBaseUri + IdentityAPI.AnonomousUser.Create; user.ID = null; user.UserName = model.Email; user.Password = model.Password; user.ConfirmPassword = model.Password; user.Email = model.Email; user.Enabled = settingValues[UserSettingKeys.EmailVerification] == "false"; IEnumerable <string> userInRoles = new List <string> { roleName }; user.UserInRoles = userInRoles; status = await _apiClient.PostAsync <OperationStatus>(user, method, true, false); if (status.IsSuccess) { JObject obj = status.Result as JObject; UserRegisterRS resUser = obj.ToObject <UserRegisterRS>(); if (!user.Enabled) { SendActivationEmail(model, resUser.Code, resUser.ID); status.Message = "Registration success. Check email on " + model.Email + " to verify your accout."; } if (model.IsSubscribe) { AddUserAsSubcriber(model); } CreateProfile(model, resUser.ID); ActionMessage(status.Message, MessageType.Success); WebBuilderController webBuilderController = new WebBuilderController(); IList <ControllerDetail> controllerDetails = await webBuilderController.GetMethodDetails("register", GetSiteID); MethodInvoke methodInvoke = new MethodInvoke(); if (controllerDetails?.Count > 0) { var reusableParam = GetReuseableParams(_memoryCache); reusableParam.UserName = model.Email; foreach (var item in controllerDetails) { methodInvoke.Execute(item, reusableParam, new List <ControllerDetail>()); } } if (string.IsNullOrEmpty(model.ReturnURL)) { RoleManager _role = new RoleManager(); model.ReturnURL = await _role.GetRoleRedirectURL(roleName, GetSiteID); if (model.ReturnURL == null) { model.ReturnURL = "/dashboard/dashboard/index" + CultureURL; } else { model.ReturnURL = model.ReturnURL + CultureURL; } } return(Redirect(model.ReturnURL)); } } else { status.Message = GetModelStateErorr(); } ActionMessage(status.Message, MessageType.Error); return(Redirect(RegistrationURL)); }
public async Task <PageDetail> GetPageDetails([FromBody] Guid pageID) { WebBuilderController cont = new WebBuilderController(_memoryCache); return(await cont.GetPageDetails(pageID)); }
public object GetComponentTemplate([FromBody] OnlineApiInfo onlineApiInfo) { WebBuilderController objController = new WebBuilderController(_memoryCache); return(objController.GetComponentTemplate(onlineApiInfo.ComponentName, onlineApiInfo.Offset, onlineApiInfo.Limit, onlineApiInfo.SearchText, onlineApiInfo.TagIDs, secureToken, GetUsername)); }
public object OnlineCompoSearchFilters([FromBody] OnlineApiInfo onlineApiInfo) { WebBuilderController objController = new WebBuilderController(_memoryCache); return(objController.OnlineCompoSearchFilters(secureToken, GetUsername)); }
public object FeedBackFromClient([FromBody] FeedbackDetails objFeedback) { WebBuilderController objController = new WebBuilderController(_memoryCache); return(objController.FeedBackFromClient(objFeedback, objFeedback.SecureToken, GetUsername)); }
public async Task <int> DeletePages([FromBody] DeletePage deletePage) { WebBuilderController cont = new WebBuilderController(_memoryCache); return(await cont.DeletePage(deletePage)); }