partial void OnHandle(RenameInventoryItemCommand command)
        {
            InventoryItem item = UnitOfWork.Get <InventoryItem>(command.Rsn);

            item.ChangeName(command.NewName);
            UnitOfWork.Commit();
        }
        public void Handle(RenameInventoryItemCommand message)
        {
            var item = _store.GetById <InventoryItem>(message.InventoryItemId);

            item.ChangeName(message.NewName);
            _store.Save(item);
        }
Exemple #3
0
        public void Handle(RenameInventoryItemCommand command)
        {
            var item = _repository.GetById(command.InventoryItemId);

            item.ChangeName(command.NewName);

            _repository.Save(item, command.OriginalVersion);
        }
        public HttpResponseMessage Put(Guid id, RenameInventoryItemCommand renameInventoryItemCommand)
        {
            int versionNumber = 0;
            int?ver           = int.TryParse(renameInventoryItemCommand.ConcurrencyVersion, out versionNumber)
                           ? (int?)versionNumber
                           : null;

            _bus.Send(new RenameInventoryItem(id,
                                              renameInventoryItemCommand.NewName, ver));

            return(Request.CreateResponse(HttpStatusCode.Accepted));
        }
Exemple #5
0
        partial void OnChangeName(IServiceRequestWithData <ISingleSignOnToken, InventoryItemServiceChangeNameParameters> serviceRequest, ref IServiceResponse results)
        {
            UnitOfWorkService.SetCommitter(this);
            InventoryItemServiceChangeNameParameters item = serviceRequest.Data;

            // The use of Guid.Empty is simply because we use ints as ids
            var command = new RenameInventoryItemCommand(item.rsn, item.newName);

            CommandSender.Send(command);

            UnitOfWorkService.Commit(this);
            results = new ServiceResponse();
        }