Beispiel #1
0
        public async Task Handle(RenameInventoryItem message)
        {
            var item = await _repository.GetById(message.InventoryItemId);

            item.ChangeName(message.NewName);
            await _repository.Save(item);
        }
Beispiel #2
0
        public void Handle(RenameInventoryItem message)
        {
            var item = _session.Get <InventoryItem>(message.Id, message.ExpectedVersion);

            item.ChangeName(message.NewName);
            _session.Commit();
        }
Beispiel #3
0
        public ActionResult ChangeName(Guid id, string name, int version)
        {
            var command = new RenameInventoryItem(id, name, version);
            _bus.Send(command);

            return RedirectToAction("Index");
        }
Beispiel #4
0
        // 重命名事件处理
        public void Handle(RenameInventoryItem message)
        {
            var item = _repository.GetById(message.InventoryItemId);

            item.ChangeName(message.NewName);
            _repository.Save(item, message.OriginalVersion);
        }
        public void Handle(RenameInventoryItem message)
        {
            var item = _repository.Get(message.AggregateId);

            item.ChangeName(message.NewName);
            _repository.Save(item, message.ExpectedVersion);
        }
Beispiel #6
0
        public async Task Handle(RenameInventoryItem message)
        {
            var item = await _session.Get <InventoryItem>(message.Id, message.ExpectedVersion);

            item.ChangeName(message.NewName);
            await _session.Commit();
        }
        public async Task HandleAsync(RenameInventoryItem message)
        {
            var item = await this.repository.GetByIdAsync(message.Id);

            item.ChangeName(message.NewName);
            await this.repository.SaveAsync(item, message.OriginalVersion);
        }
        public ActionResult ChangeName(Guid id, string name, int version)
        {
            var command = new RenameInventoryItem(id, name, version);

            _bus.Send(command);
            return(RedirectToAction("Index"));
        }
Beispiel #9
0
        public IEnumerable<Event> Handle(RenameInventoryItem cmd)
        {
            CheckIsActive();

            if (string.IsNullOrEmpty(cmd.NewName))
                throw new ArgumentException("Inventory item name cannot be null or empty");

            yield return new InventoryItemRenamed(name, cmd.NewName);
        }
        public void Put(Guid id, InventoryItemDetailsDto request)
        {
            var command = new RenameInventoryItem(request.Id, request.Name, request.Version);

            _bus.Send(command);
        }
 public void Handle(RenameInventoryItem message)
 {
     var item = _repository.GetById(message.InventoryItemId);
     item.ChangeName(message.NewName);
     _repository.Save(item, message.OriginalVersion);
 }