public void Execute() { var acceptNewInmateProcess = new AcceptInmateProcess(); acceptNewInmateProcess.Consume(new NewInmateArrived() { FirstName = _firstName, LastName = _lastName, DateOfBirth = _dateOfBirth, LocationId = _locationId }); acceptNewInmateProcess.Consume(new WarrantsReceived() { Warrants = _warrants }); }
public void Execute() { var dossier = Session.Query<Dossier>() .Where(d => d.InmateId == _inmateId) .SingleOrDefault(); Warrant warrant = null; switch (_warrantType) { case WarrantType.Arrest: warrant = new ArrestWarrant() { Duration = _duration, EffectiveFrom = _effectiveFrom, IssueAt = _issueAt, IssuerId = _issuerId, ScanLocationUrl = _scanLocationUrl }; break; case WarrantType.Detention: warrant = new DetentionWarrant() { Duration = _duration, EffectiveFrom = _effectiveFrom, IssueAt = _issueAt, IssuerId = _issuerId, ScanLocationUrl = _scanLocationUrl }; break; case WarrantType.Remand: warrant = new RemandWarrant() { EffectiveFrom = _effectiveFrom, IssueAt = _issueAt, IssuerId = _issuerId, ScanLocationUrl = _scanLocationUrl }; break; case WarrantType.Sentencing: warrant = new SentencingWarrant() { Duration = _duration, EffectiveFrom = _effectiveFrom, IssueAt = _issueAt, IssuerId = _issuerId, ScanLocationUrl = _scanLocationUrl }; break; default: throw new ArgumentOutOfRangeException("warrantType"); } dossier.AddWarrant(warrant); var acceptInmateProcess = new AcceptInmateProcess(); acceptInmateProcess.Consume(new WarrantsReceived() { Warrants = new [] { warrant } }); }