Beispiel #1
0
        public async Task <IActionResult> Delete(int id)
        {
            var removeApplicationCommand = new RemoveApplicationCommand(id);
            var response = await _mediator.Send(removeApplicationCommand);

            return(Ok(response));
        }
Beispiel #2
0
        /// <summary>
        /// 删除应用程序
        /// </summary>
        /// <param name="application"></param>
        /// <returns></returns>
        public ReturnValue Remove(RemoveApplicationCommand command)
        {
            var result = new ReturnValue();

            try
            {
                var application = initApplication(command.AppId, command.AppToken);

                //添加到资源库之前业务规则验证
                //Validate(application);

                _applicationRepository.RemoveApplication(application);

                //发送应用程序删除的事件
                _eventBus.Send(new ApplicationRemovedEvent()
                {
                    AppId = application.AppId
                });
            }
            catch (BusinessRuleException excep)
            {
                // TODO...
                return(excep.ReturnValue);
            }

            return(result);
        }
        public CommandResult Handle(RemoveApplicationCommand command)
        {
            var retValue = _applicationServer.Remove(command);

            return(new CommandResult()
            {
                Values = retValue
            });
        }
        public ActionResult Remove(RemoveApplicationCommand command)
        {
            var result = new RemoveApplicationResult();

            var commandResult = _commandBus.Send(command);

            return(new JsonResult()
            {
                Data = result
            });
        }