GlobalStoryGrid IGlobalStoryGridService.Update(GlobalStoryGrid updated, Guid currentUserId) { using (var session = _sessionFactory.OpenSession()) { using (var transaction = session.BeginTransaction()) { var existing = session.Query <GlobalStoryGrid>().First(x => x.Id == updated.Id); existing.Title = updated.Title; existing.ControllingIdeaTheme = updated.ControllingIdeaTheme; existing.ExternalGenre = updated.ExternalGenre; existing.ExternalValueAtStake = updated.ExternalValueAtStake; existing.InternalGenre = updated.InternalGenre; existing.InternalValueAtStake = updated.InternalValueAtStake; existing.ObjectsOfDesire = updated.ObjectsOfDesire; existing.PointOfView = updated.PointOfView; existing.ObligatoryScenesAndConventions = updated.ObligatoryScenesAndConventions; UpdateSection(updated.BeginningHook, existing.BeginningHook); UpdateSection(updated.MiddleBuild, existing.MiddleBuild); UpdateSection(updated.EndingPayoff, existing.EndingPayoff); session.Update(existing); transaction.Commit(); return(existing); } } }
public Guid NewGlobalStoryGrid(Guid projectId) { var newGlobalStoryGrid = new GlobalStoryGrid(); var id = _globalStoryGridService.Add(newGlobalStoryGrid, projectId, CurrentUser.Id); return(id); }
Guid IGlobalStoryGridService.Add(GlobalStoryGrid newGlobalStoryGrid, Guid projectId, Guid currentUserId) { using (var session = _sessionFactory.OpenSession()) { using (var transaction = session.BeginTransaction()) { var project = session.Query <Project>().Single(x => x.Id == projectId); newGlobalStoryGrid.Project = project; newGlobalStoryGrid.Title = project.Title + " Story Grid"; newGlobalStoryGrid.BeginningHook = CreateStoryGridSection(session); newGlobalStoryGrid.MiddleBuild = CreateStoryGridSection(session); newGlobalStoryGrid.EndingPayoff = CreateStoryGridSection(session); var id = session.Save(newGlobalStoryGrid); transaction.Commit(); return((Guid)id); } } }