public override IList<ICommand> GenerateUpdateCommand(IDataItem dataItem)
 {
     var list = new List<ICommand>();
     Assert.IsTrue(dataItem is ContentDataItem, "Incorrect item type. Probably problem with engine");
     var target = dataItem as ContentDataItem;
     Assert.IsNotNull(target, "DataItem");
     if (CompareIds(target) != 0)
     {
         list.AddRange(this.GenerateDeleteCommand());
         list.AddRange(target.GenerateAddCommand());
         return list;
     }
     var item = new ChangeItemCommand(this, target);
     if (!item.IsEmpty)
     {
         list.Add(item);
     }
     return list;
 }
        public override IList <ICommand> GenerateUpdateCommand(IDataItem dataItem)
        {
            var list = new List <ICommand>();

            Assert.IsTrue(dataItem is ContentDataItem, "Incorrect item type. Probably problem with engine");
            var target = dataItem as ContentDataItem;

            Assert.IsNotNull(target, "DataItem");
            if (CompareIds(target) != 0)
            {
                list.AddRange(this.GenerateDeleteCommand());
                list.AddRange(target.GenerateAddCommand());
                return(list);
            }
            var item = new ChangeItemCommand(this, target);

            if (!item.IsEmpty)
            {
                list.Add(item);
            }
            return(list);
        }
Пример #3
0
        public async Task <IActionResult> ChangeItem(int uId, int gId, int sId, int itId, ChangeItemCommand changeItemCommand)
        {
            changeItemCommand.Finalize(uId, gId, sId, itId);

            await _mediator.Send(changeItemCommand);

            return(Ok());
        }