Пример #1
0
        public void User_Can_Remove_Buttons_from_Leads_tab()
        {
            LeadsPage.GoTo();
            LeadPage.RemoveButtons();

            Assert.IsTrue(LeadPage.ButtonsRemoved(), "Removal of one of the Text Message buttons failed.");
            LeadPage.ReturnToHomePage();
        }
        public async Task <ActionResult> DeleteLeadPage(int leadPageId)
        {
            LeadPage leadPage = await unitOfWork.LeadPages.Get(leadPageId);

            unitOfWork.LeadPages.Remove(leadPage);
            await unitOfWork.Save();


            return(Ok());
        }
        public async Task <ActionResult> UpdateLeadPage(UpdatedPage updatedPage)
        {
            LeadPage leadPage = await unitOfWork.LeadPages.Get(updatedPage.PageId);

            leadPage.Name    = updatedPage.Name;
            leadPage.Content = updatedPage.Content;

            // Update and save
            unitOfWork.LeadPages.Update(leadPage);
            await unitOfWork.Save();

            return(Ok());
        }
        public async Task <ActionResult> AddLeadPage(int nicheId)
        {
            string leadPageName      = "New Lead Page";
            string leadPageEmailName = "New Lead Page Email";


            // Create the new lead page
            LeadPage leadPage = new LeadPage
            {
                NicheId = nicheId,
                Name    = leadPageName,
                Content = ""
            };

            // Add and save
            unitOfWork.LeadPages.Add(leadPage);
            await unitOfWork.Save();

            // Update the content with the new Id and update
            leadPage.Content = "{\"id\":" + leadPage.Id + ",\"name\":\"" + leadPageName + "\",\"background\":{\"color\":\"#ffffff\"}}";
            unitOfWork.LeadPages.Update(leadPage);



            // Create the new lead page email
            LeadPageEmail leadPageEmail = new LeadPageEmail
            {
                LeadPageId = leadPage.Id,
                Name       = leadPageEmailName,
                Content    = ""
            };


            // Add and save
            unitOfWork.LeadPageEmails.Add(leadPageEmail);
            await unitOfWork.Save();


            // Update the content with the new Id
            leadPageEmail.Content = "{\"id\":" + leadPageEmail.Id + ",\"name\":\"" + leadPageEmailName + "\",\"background\":{\"color\":\"#ffffff\"}}";


            // Update and save
            unitOfWork.LeadPageEmails.Update(leadPageEmail);
            await unitOfWork.Save();


            // Return the new lead page content
            return(Ok(leadPage.Content));
        }
        public async Task <ActionResult> DuplicateLeadPage(int leadPageId)
        {
            // Get the lead page
            LeadPage leadPage = await unitOfWork.LeadPages.Get(leadPageId);

            leadPage.Id = 0;

            // Add the duplicated lead page and save
            unitOfWork.LeadPages.Add(leadPage);
            await unitOfWork.Save();


            // Update the content with the new id
            leadPage.Content = Regex.Replace(leadPage.Content, "^{\"id\":" + leadPageId, "{\"id\":" + leadPage.Id);
            unitOfWork.LeadPages.Update(leadPage);


            // Get the lead page email
            LeadPageEmail leadPageEmail = await unitOfWork.LeadPageEmails.Get(x => x.LeadPageId == leadPageId);

            // Get the current id for later use
            int leadPageEmailId = leadPageEmail.Id;

            // Reset the id and assign the new lead page id
            leadPageEmail.Id         = 0;
            leadPageEmail.LeadPageId = leadPage.Id;


            // Add the new lead page email and save
            unitOfWork.LeadPageEmails.Add(leadPageEmail);
            await unitOfWork.Save();


            // Update the content and save
            leadPageEmail.Content = Regex.Replace(leadPageEmail.Content, "^{\"id\":" + leadPageEmailId, "{\"id\":" + leadPageEmail.Id);
            unitOfWork.LeadPageEmails.Update(leadPageEmail);
            await unitOfWork.Save();


            // Return the lead page content
            return(Ok(leadPage.Content));
        }