public PageContent AddNewPage(Page page, string text, string editedBy, DateTime editedOn) { PageEntity pageEntity = new PageEntity(); ToEntity.FromPage(page, pageEntity); pageEntity.Id = 0; UnitOfWork.Add(pageEntity); UnitOfWork.SaveChanges(); PageContentEntity pageContentEntity = new PageContentEntity() { Id = Guid.NewGuid(), Page = pageEntity, Text = text, EditedBy = editedBy, EditedOn = editedOn, VersionNumber = 1, }; UnitOfWork.Add(pageContentEntity); UnitOfWork.SaveChanges(); PageContent pageContent = FromEntity.ToPageContent(pageContentEntity); pageContent.Page = FromEntity.ToPage(pageEntity); return(pageContent); }
public PageContent AddNewPage(Page page, string text, string editedBy, DateTime editedOn, DateTime projectStart, DateTime projectEnd, bool projectEstimatedTime, string projectStatus, string projectLanguage, int orgID) { PageEntity pageEntity = new PageEntity(); ToEntity.FromPage(page, pageEntity); pageEntity.Id = 0; UnitOfWork.Add(pageEntity); UnitOfWork.SaveChanges(); PageContentEntity pageContentEntity = new PageContentEntity() { Id = Guid.NewGuid(), Page = pageEntity, Text = text, EditedBy = editedBy, EditedOn = editedOn, VersionNumber = 1, ProjectStart = projectStart, ProjectEnd = projectEnd, ProjectEstimatedTime = projectEstimatedTime, ProjectStatus = projectStatus, ProjectLanguage = projectLanguage, orgID = orgID, }; UnitOfWork.Add(pageContentEntity); UnitOfWork.SaveChanges(); PageContent pageContent = FromEntity.ToPageContent(pageContentEntity); pageContent.Page = FromEntity.ToPage(pageEntity); return(pageContent); }
public Page SaveOrUpdatePage(Page page) { PageEntity entity = UnitOfWork.FindById <PageEntity>(page.Id); if (entity == null) { entity = new PageEntity(); ToEntity.FromPage(page, entity); UnitOfWork.Add(entity); UnitOfWork.SaveChanges(); page = FromEntity.ToPage(entity); } else { ToEntity.FromPage(page, entity); UnitOfWork.SaveChanges(); page = FromEntity.ToPage(entity); } return(page); }
public PageContent AddNewPage(Page page, string text, string editedBy, DateTime editedOn, DateTime projectStart, DateTime projectEnd, bool projectEstimatedTime, string projectStatus, Phase2Params phase2Params, string projectLanguage, int orgID) { PageEntity pageEntity = new PageEntity(); ToEntity.FromPage(page, pageEntity); pageEntity.Id = 0; UnitOfWork.Add(pageEntity); UnitOfWork.SaveChanges(); PageContentEntity pageContentEntity = new PageContentEntity() { Id = Guid.NewGuid(), Page = pageEntity, Text = text, EditedBy = editedBy, EditedOn = editedOn, VersionNumber = 1, ProjectStart = projectStart, ProjectEnd = projectEnd, ProjectEstimatedTime = projectEstimatedTime, ProjectStatus = projectStatus, ProjectLanguage = projectLanguage, orgID = orgID, Owner = phase2Params.Owner, OwnerEmail = phase2Params.OwnerEmail, Department = phase2Params.Department, CollaborationLevel = phase2Params.CollaborationLevel, ProjectAgileLifeCyclePhase = phase2Params.ProjectAgileLifeCyclePhase, FundingBoundary = phase2Params.FundingBoundary }; UnitOfWork.Add(pageContentEntity); UnitOfWork.SaveChanges(); PageContent pageContent = PageContent.FromPageContentEntity(pageContentEntity); pageContent.Page = Page.FromPageEntity(pageEntity); return(pageContent); }