public void LogModificationToText(Guid textId) { if (TextRepository.Exists(textId)) { Text textOfModdedDocument = TextRepository.GetById(textId); Content contentOfModdedDocument = textOfModdedDocument.ContentThatBelongs; if (HeaderRepository.ExistsWithContent(contentOfModdedDocument)) { Header headerOfModdedDocument = HeaderRepository.GetByContent(contentOfModdedDocument); LogModificationToDocument(headerOfModdedDocument.DocumentThatBelongs.Id); } else if (ParagraphRepository.ExistsWithContent(contentOfModdedDocument)) { Paragraph paragraphOfModdedDocument = ParagraphRepository.GetByContent(contentOfModdedDocument); LogModificationToDocument(paragraphOfModdedDocument.DocumentThatBelongs.Id); } else if (FooterRepository.ExistsWithContent(contentOfModdedDocument)) { Footer footerOfModdedDocument = FooterRepository.GetByContent(contentOfModdedDocument); LogModificationToDocument(footerOfModdedDocument.DocumentThatBelongs.Id); } } else { throw new MissingTextException("This text is not in the database."); } }
public Text AddToFooter(Guid footerId, Text text) { if (FooterRepository.Exists(footerId)) { Footer footer = FooterRepository.GetById(footerId); footer.StyleClass = null; Footer footerForText = footer; Content contentOfFooter = footerForText.Content; IEnumerable <Text> footerTexts = TextRepository.GetByContent(contentOfFooter); if (footerTexts.Count() == 0) { text.Id = Guid.NewGuid(); text.Position = 0; text.ContentThatBelongs = contentOfFooter; TextRepository.Add(text); return(text); } else { throw new ExistingTextException("There is an existing text in the selected footer."); } } else { throw new MissingFooterException("This footer does not exist in the database"); } }
public void Delete(Guid footerId) { if (FooterRepository.Exists(footerId)) { FooterRepository.Delete(footerId); } else { throw new MissingFooterException("This footer is not in the database."); } }
public void LogModificationToFooter(Guid footerId) { if (FooterRepository.Exists(footerId)) { Footer footerOfModdedDocument = FooterRepository.GetById(footerId); LogModificationToDocument(footerOfModdedDocument.DocumentThatBelongs.Id); } else { throw new MissingFooterException("This footer is not in the database."); } }
public void Update(Guid footerId, Footer newFooterData) { if (FooterRepository.Exists(footerId)) { Footer footerToUpdate = FooterRepository.GetById(footerId); if (newFooterData.StyleClass != null && !StyleClassRepository.Exists(newFooterData.StyleClass.Name)) { newFooterData.StyleClass = null; } footerToUpdate.StyleClass = newFooterData.StyleClass; FooterRepository.Update(footerToUpdate); } else { throw new MissingFooterException("The footer is not in the database."); } }
public FooterRepositoryTest() { _config = new ContentfulConfig("test") .Add("DELIVERY_URL", "https://fake.url") .Add("TEST_SPACE", "SPACE") .Add("TEST_ACCESS_KEY", "KEY") .Add("TEST_MANAGEMENT_KEY", "KEY") .Build(); var contentfulClientManager = new Mock <IContentfulClientManager>(); _client = new Mock <IContentfulClient>(); _contentfulFactory = new Mock <IContentfulFactory <ContentfulFooter, Footer> >(); contentfulClientManager.Setup(o => o.GetClient(_config)).Returns(_client.Object); _repository = new FooterRepository(_config, contentfulClientManager.Object, _contentfulFactory.Object); }
public Footer GetByDocument(Guid documentId) { if (DocumentRepository.Exists(documentId)) { if (FooterRepository.ExistsForDocument(documentId)) { return(FooterRepository.GetByDocument(documentId)); } else { throw new MissingFooterException("This footer is not in the database"); } } else { throw new MissingDocumentException("This document is not on the database."); } }
public Text GetByFooter(Guid footerId) { if (FooterRepository.Exists(footerId)) { Footer footerForText = FooterRepository.GetById(footerId); Content contentOfFooter = footerForText.Content; IEnumerable <Text> footerTexts = TextRepository.GetByContent(contentOfFooter); if (footerTexts.Count() != 0) { return(footerTexts.First()); } else { throw new MissingTextException("This text is not in the database"); } } else { throw new MissingFooterException("This footer does not exist in the database"); } }
public UnitOfWork(ApplicationDbContext db, IOptions <AppSettings> appSettings) { _db = db; Menu = new MenuRepository(_db); MenuAdjustment = new MenuAdjustmentRepository(_db); Layout = new LayoutRepository(_db); HomePageBanner = new HomePageBannerRepository(_db); HomePage = new HomePageRepository(_db); Project = new ProjectRepository(_db); ProjectCategory = new ProjectCategoryRepository(_db); CultureLayout = new CultureLayoutRepository(_db); CultureSection = new CultureSectionRepository(_db); CulturePost = new CulturePostRepository(_db); CulturePicture = new CulturePictureRepository(_db); CultureAlbum = new CultureAlbumRepository(_db); News = new NewsRepository(_db); VisionMission = new VisionMissionRepository(_db); Partners = new PartnerRespository(_db); PartnerTypes = new PartnerTypeRespository(_db); Footer = new FooterRepository(_db); Menu = new MenuRepository(_db); SolutionContent = new SolutionContentRepository(_db); SolutionCategory = new SolutionCategoryRepository(_db); SolutionPicture = new SolutionPictureRepository(_db); RecruitmentBanner = new RecruitmentBannerRepository(_db); RecruitmentCareers = new RecruitmentCareersRepository(_db); RecruitmentJob = new RecruitmentJobRepository(_db); VisionMission = new VisionMissionRepository(_db); Footer = new FooterRepository(_db); FooterAdjustment = new FooterAdjustmentRepository(_db); AppUser = new AppUserRepository(_db, appSettings); NewsCategory = new NewsCategoryRepository(_db); ColorPage = new ColorPageRepository(_db); }
public Footer Add(Guid documentId, Footer footer) { if (DocumentRepository.Exists(documentId)) { if (!FooterRepository.ExistsForDocument(documentId)) { Document documentThatBelongs = DocumentRepository.GetById(documentId); documentThatBelongs.StyleClass = null; footer.DocumentThatBelongs = documentThatBelongs; footer.Id = Guid.NewGuid(); footer.Content = new Content() { Id = Guid.NewGuid() }; if (footer.StyleClass != null && !StyleClassRepository.Exists(footer.StyleClass.Name)) { footer.StyleClass = null; } ContentRepository.Add(footer.Content); FooterRepository.Add(footer); return(footer); } else { throw new ExistingFooterException("This document already has a footer."); } } else { throw new MissingDocumentException("This document is not in the database."); } }
private string ApplyDocumentStyle(Document document, Format format) { IEnumerable <Style> currentStyles = GetStylesWithInheritance(document.StyleClass, format); string appliedHtmlCode = ""; if (!HeaderRepository.ExistsForDocument(document.Id) && !FooterRepository.ExistsForDocument(document.Id)) { appliedHtmlCode = "" + ApplyParagraphStyles(ParagraphRepository.GetAllByDocument(document.Id), format, currentStyles); } else if (!FooterRepository.ExistsForDocument(document.Id)) { appliedHtmlCode = "" + ApplyHeaderStyle(HeaderRepository.GetByDocument(document.Id), format, currentStyles) + "<br>" + ApplyParagraphStyles(ParagraphRepository.GetAllByDocument(document.Id), format, currentStyles); } else { appliedHtmlCode = "" + ApplyHeaderStyle(HeaderRepository.GetByDocument(document.Id), format, currentStyles) + "<br>" + ApplyParagraphStyles(ParagraphRepository.GetAllByDocument(document.Id), format, currentStyles) + "<br>" + ApplyFooterStyles(FooterRepository.GetByDocument(document.Id), format, currentStyles); } return(appliedHtmlCode); }
public HomeApiController() { MenuRepository = new MenuRepository(); SlideRepository = new SlideRepository(); FooterRepository = new FooterRepository(); }
public FooterController() { this.footerRepository = new FooterRepository(); }
public FooterBusiness() { _footerRepository = new FooterRepository(); }
public FooterBusiness(FooterRepository footerRepository) { _footerRepository = footerRepository; }
public FooterService(FooterRepository repo) { Repo = repo; }