Ejemplo n.º 1
0
        /// <summary>
        /// Connect to database and add update pages.
        /// </summary>
        /// <param name="objPage">Object of PortalPage class.</param>
        public async Task <string> AddUpdatePages(PortalPage objPage, List <PageRolePermission> RolePermissions, int siteID, string userName)
        {
            SQLExecuteNonQueryAsync sagesql = new SQLExecuteNonQueryAsync();

            List <SQLParam> sQLParam = new List <SQLParam>();

            sQLParam.Add(new SQLParam("@PageID", objPage.PageID));
            sQLParam.Add(new SQLParam("@PageName", objPage.PageName.ToString()));
            sQLParam.Add(new SQLParam("@Title", objPage.Title));
            sQLParam.Add(new SQLParam("@Description", objPage.Description));
            sQLParam.Add(new SQLParam("@KeyWords", objPage.KeyWords));
            sQLParam.Add(new SQLParam("@IsActive", objPage.IsActive));
            sQLParam.Add(new SQLParam("@SiteID", siteID));
            sQLParam.Add(new SQLParam("@AddedBy", userName));
            try
            {
                string pageid = string.Empty;
                pageid = await sagesql.ExecuteNonQueryAsGivenTypeAsync <string>("[usp_PageMgr_AddUpdatePage]", sQLParam, "@output");

                if (pageid != string.Empty && RolePermissions.Count > 0)
                {
                    foreach (PageRolePermission rolePermission in RolePermissions)
                    {
                        await  AddUpdteRolePermission(pageid, rolePermission.RoleName, rolePermission.SelectedPageActions, userName);
                    }
                }
                return(pageid);
            }
            catch
            {
                throw;
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Add update page.
        /// </summary>
        /// <param name="objPage">Object of PortalPage class.</param>
        public async Task <string> AddUpdatePages(PortalPage objPage, List <PageRolePermission> RolePermissions, string hostUrl, int siteID, string userName)
        {
            string           pageID      = string.Empty;
            PageDataProvider objProvider = new PageDataProvider();

            pageID = await objProvider.AddUpdatePages(objPage, RolePermissions, siteID, userName);

            //For SEO Meta Data

            List <SEOMetaValues> metaValues = new List <SEOMetaValues>();
            SEOMetaValues        title      = new SEOMetaValues();

            title.SEOMetaTagTypeID = 1; //Type
            title.MetaTagContent   = objPage.PageName;
            metaValues.Add(title);

            SEOMetaValues desc = new SEOMetaValues();

            desc.SEOMetaTagTypeID = 2;//Title
            desc.MetaTagContent   = objPage.Title;
            metaValues.Add(desc);

            SEOMetaValues image = new SEOMetaValues();

            image.SEOMetaTagTypeID = 4;//Description
            image.MetaTagContent   = string.Empty;
            metaValues.Add(image);

            SEOMetaValues type = new SEOMetaValues();

            type.SEOMetaTagTypeID = 5;//Url
            type.MetaTagContent   = string.Empty;
            metaValues.Add(type);

            SEOController seoContrl = new SEOController();
            await seoContrl.SaveSEOMetaTag(pageID, metaValues, userName, hostUrl);

            return(pageID);
        }