public HttpResponseMessage Post(Guid id, RemoveItemsFromInventoryCommand removeItemsFromInventory)
        {
            _bus.Send(new RemoveItemsFromInventory(id,
                                                   removeItemsFromInventory.Count));

            return(Request.CreateResponse(HttpStatusCode.Accepted));
        }
        partial void OnHandle(RemoveItemsFromInventoryCommand command)
        {
            InventoryItem item = UnitOfWork.Get <InventoryItem>(command.Rsn);

            item.Remove(command.Count);
            UnitOfWork.Commit();
        }
Example #3
0
        public void Handle(RemoveItemsFromInventoryCommand command)
        {
            var item = _repository.GetById(command.InventoryItemId);

            item.Remove(command.Count);

            _repository.Save(item, command.OriginalVersion);
        }
Example #4
0
        partial void OnRemove(IServiceRequestWithData <ISingleSignOnToken, InventoryItemServiceRemoveParameters> serviceRequest, ref IServiceResponse results)
        {
            UnitOfWorkService.SetCommitter(this);
            InventoryItemServiceRemoveParameters item = serviceRequest.Data;

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

            CommandSender.Send(command);

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