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 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); }
/// <summary> /// This updates an existing set of text and is used for page rename updates. /// To add a new version of a page, use AddNewPageContentVersion /// </summary> /// <param name="content"></param> public void UpdatePageContent(PageContent content) { PageContentEntity entity = UnitOfWork.FindById <PageContentEntity>(content.Id); if (entity != null) { ToEntity.FromPageContent(content, entity); UnitOfWork.SaveChanges(); content = FromEntity.ToPageContent(entity); } }
public Relationship AddNewRel(Relationship rel, int reltypeid, string username, int orgID, int pageID, string reltext) { RelEntity relEntity = new RelEntity(); ToEntity.FromRelationship(rel, relEntity); relEntity.username = username; relEntity.orgId = orgID; relEntity.pageId = pageID; relEntity.relDateTime = DateTime.Now; UnitOfWork.Add(relEntity); UnitOfWork.SaveChanges(); Relationship newrel = FromEntity.ToRel(relEntity); return(newrel); }
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 Relationship SaveOrUpdateRel(Relationship rel) { RelEntity entity = UnitOfWork.FindById <RelEntity>(rel.Id); if (entity == null) { entity = new RelEntity(); ToEntity.FromRelationship(rel, entity); UnitOfWork.Add(entity); UnitOfWork.SaveChanges(); rel = FromEntity.ToRel(entity); } else { ToEntity.FromRelationship(rel, entity); UnitOfWork.SaveChanges(); rel = FromEntity.ToRel(entity); } return(rel); }
public User SaveOrUpdateUser(User user) { UserEntity entity = UnitOfWork.FindById <UserEntity>(user.Id); if (entity == null) { // Turn the domain object into a database entity entity = new UserEntity(); ToEntity.FromUser(user, entity); UnitOfWork.Add(entity); UnitOfWork.SaveChanges(); user = FromEntity.ToUser(entity); } else { ToEntity.FromUser(user, entity); UnitOfWork.SaveChanges(); } return(user); }
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); }
public Relationship SaveOrUpdateRel(Relationship rel) { RelEntity entity = UnitOfWork.FindById <RelEntity>(rel.id); if (entity == null) { entity = new RelEntity(); ToEntity.FromRelationship(rel, entity); UnitOfWork.Add(entity); UnitOfWork.SaveChanges(); rel = FromEntity.ToRel(entity); } else { rel.orgID = GetUserByUsername(rel.username).orgID; ToEntity.FromRelationship(rel, entity); UnitOfWork.SaveChanges(); rel = FromEntity.ToRel(entity); } return(rel); }