public DomainViewModel AddDomain(DomainViewModel domain) { var domainToAdd = DomainMapper.MapModelToEntity(domain); domainToAdd.CreatedBy = "TEST"; domainToAdd.SeedData = false; var addedDomain = _domainRepository.Add(domainToAdd); return(DomainMapper.MapEntityToModel(addedDomain)); }
public void Execute(AssignNewBankCardCommand assignNewCancelReportStolenBankCardCommand) { var client = _repository.GetById <Client>(assignNewCancelReportStolenBankCardCommand.Id); client.AssignNewBankCardForAccount(assignNewCancelReportStolenBankCardCommand.AccountId); _repository.Add(client); }
public void Execute(OpenNewAccountForClientCommand compensatingCommand) { var client = _repository.GetById <Client>(compensatingCommand.Id); var activeAccount = client.CreateNewAccount(compensatingCommand.AccountName); _repository.Add(activeAccount); }
public void Execute(ReportStolenBankCardCommand cancelReportStolenBankCardCommand) { var client = _repository.GetById <Client>(cancelReportStolenBankCardCommand.Id); var bankCard = client.GetBankCard(cancelReportStolenBankCardCommand.BankCardId); bankCard.BankCardIsReportedStolen(); _repository.Add(client); }
public void Execute(CloseAccountCommand compensatingCommand) { var activeAccount = _repository.GetById <ActiveAccount>(compensatingCommand.Id); var closedAccount = activeAccount.Close(); _repository.Add(closedAccount); }
/// <summary> /// Accepts the unit of work and persist the changes. /// </summary> public void Accept() { while (_dirtyInstances.Count > 0) { var dirtyInstance = _dirtyInstances.Dequeue(); _repository.Add(dirtyInstance); } }
public void Handle(ScheduleMeetingCommand command) { var meeting = new MeetingFactory().Schedule(command.MeetingId, command.On, command.LocationId, command.SpeakerId, command.Capacity); repository.Add(meeting); //events from meeting? //AddNewSessionToSpeakerProfile(meeting.Id); //AddLocationUsage(meeting.Id) }
public void When_calling_Save_it_will_add_the_domain_events_to_the_domain_event_storage() { _ledgers = new List <Ledger> { new CreditMutation(1, new AccountNumber("0987654321")), new DebitMutation(1, new AccountNumber("0987654321")), new CreditTransfer(1, new AccountNumber("0987654321")), new DebitTransfer(1, new AccountNumber("0987654321")), new DebitTransferFailed(1, new AccountNumber("0987654321")), }; var closedAccount = ClosedAccount.CreateNew(Guid.NewGuid(), Guid.NewGuid(), _ledgers, new AccountName("AccountName"), new AccountNumber("1234567890")); _repository.Add(closedAccount); _eventStoreUnitOfWork.Commit(); Assert.That(_domainEventStorage.GetEventsSinceLastSnapShot(closedAccount.Id).Count(), Is.EqualTo(1)); Assert.That(_domainEventStorage.GetAllEvents(closedAccount.Id).Count(), Is.EqualTo(1)); }
protected override async Task <Unit> ProcessHandle(UploadDocumentCommand request, CancellationToken cancellationToken) { if (request == null) { throw new ArgumentNullException(nameof(request)); } var fileLocation = await fileRepository.UploadFile(request.DocumentDto.Name, request.DocumentDto.FileData, request.DocumentDto.ContentType); await domainRepository.Add(new Document(Guid.NewGuid(), request.DocumentDto.Name, fileLocation, request.DocumentDto.Length, request.DocumentDto.ContentType), cancellationToken); return(Unit.Value); }
public Guid Invoke(DomainModel domain, Guid?userId = null) { if (!domain.IsValid() || domainRepository.FindBy(x => x.Name == domain.Name).Count() > 0) { return(Guid.Empty); } var newDomain = AutoMapper.Mapper.Map <DataAccess.Models.Domain>(domain); domainRepository.Add(newDomain); _unitOfWork.Save(); return(newDomain.Id); }
public void Execute(CreateCategoryCommand command) { var category = Category.CreateNew(command.CategoryName); _repository.Add(category); }
public void Execute(CreateProductCommand command) { var product = Product.CreateNew(command.Name); _repository.Add(product); }
public void When_calling_Save_it_will_add_the_domain_events_to_the_domain_event_storage() { var client = Client.CreateNew(new ClientName("New Client"), new Address("Street", "123", "5000", "Bergen"), new PhoneNumber("1234567890")); client.UpdatePhoneNumber(new PhoneNumber("1234567890")); client.UpdatePhoneNumber(new PhoneNumber("1234567890")); _repository.Add(client); _eventStoreUnitOfWork.Commit(); Assert.That(_domainEventStorage.GetEventsSinceLastSnapShot(client.Id).Count(), Is.EqualTo(3)); Assert.That(_domainEventStorage.GetAllEvents(client.Id).Count(), Is.EqualTo(3)); }
public void When_calling_Save_it_will_add_the_domain_events_to_the_domain_event_storage() { var activeAccount = ActiveAccount.CreateNew(Guid.NewGuid(), "AccountName"); activeAccount.Deposite(new Amount(1)); activeAccount.Deposite(new Amount(1)); _repository.Add(activeAccount); _eventStoreUnitOfWork.Commit(); Assert.That(_domainEventStorage.GetEventsSinceLastSnapShot(activeAccount.Id).Count(), Is.EqualTo(3)); Assert.That(_domainEventStorage.GetAllEvents(activeAccount.Id).Count(), Is.EqualTo(3)); }
public virtual TEntity Add(TEntity obj) { return(repository.Add(obj)); }
public void Execute(CreateUserCommand command) { var user = new User(command.Id, command.Name); _userRepository.Add(user); }
public void Execute(CreateClientCommand compensatingCommand) { var client = Client.CreateNew(new ClientName(compensatingCommand.ClientName), new Address(compensatingCommand.Street, compensatingCommand.StreetNumber, compensatingCommand.PostalCode, compensatingCommand.City), new PhoneNumber(compensatingCommand.PhoneNumber)); _repository.Add(client); }