public long StartNewPoem(StartPoemConfiguration configuration) { InsertNewUserProfiles(configuration.InvitedPlayers); InsertFacebookRequestsForEachInvitedPlayer( configuration.AuthorId, configuration.InvitedPlayers, configuration.AssociatedFacebookRequestId); using (TransactionScope scope = new TransactionScope()) { var poem = InsertNewPoem(configuration); InsertPoemPlayers(configuration.AuthorId, configuration.InvitedPlayers, poem.Id); InsertPoemRequestsForPlayers(configuration.AuthorId, poem.Id, configuration.InvitedPlayers); InsertInvitationToPoemEventsForEachPlayer(configuration.AuthorId, configuration.InvitedPlayers, poem); scope.Complete(); return poem.Id; } }
private Poem InsertNewPoem(StartPoemConfiguration configuration) { Poem poem = configuration.FromConfiguration(); poemRepository.Insert(poem).Commit(); return poem; }