示例#1
0
        partial void OnHandle(DeactivateInventoryItemCommand command)
        {
            InventoryItem item = UnitOfWork.Get <InventoryItem>(command.Rsn);

            item.Deactivate();
            UnitOfWork.Commit();
        }
        public void Handle(DeactivateInventoryItemCommand message)
        {
            var item = _store.GetById <InventoryItem>(message.InventoryItemId);

            item.Deactivate();
            _store.Save(item);
        }
示例#3
0
        public void Handle(DeactivateInventoryItemCommand command)
        {
            var item = _repository.GetById(command.InventoryItemId);

            item.Deactivate();

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

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

            CommandSender.Send(command);

            UnitOfWorkService.Commit(this);
            results = new ServiceResponse();
        }
        public HttpResponseMessage Delete(Guid id, DeactivateInventoryItemCommand deactivateInventoryItem)
        {
            int versionNumber = 0;
            int?ver           = int.TryParse(deactivateInventoryItem.ConcurrencyVersion, out versionNumber)
                           ? (int?)versionNumber
                           : null;

            deactivateInventoryItem.Id = id;
            _bus.Send(new DeactivateInventoryItem(deactivateInventoryItem.Id,
                                                  ver));

            return(Request.CreateResponse(HttpStatusCode.Accepted));
        }