示例#1
0
        public async Task <ActionResult> Unpublish()
        {
            if (this._conference == null)
            {
                return(HttpNotFound());
            }

            var command = new UnpublishConference {
                AggregateRootId = this._conference.Id
            };
            var result = await ExecuteCommandAsync(command);

            if (!result.IsSuccess())
            {
                throw new InvalidOperationException(result.GetErrorMessage());
            }

            return(RedirectToAction("Index", new { slug = this._conference.Slug, accessCode = this._conference.AccessCode }));
        }
示例#2
0
        public async Task HandleAsync(ICommandContext context, UnpublishConference command)
        {
            var conference = await context.GetAsync <Conference>(command.AggregateRootId);

            conference.Unpublish();
        }
        public async Task<ActionResult> Unpublish()
        {
            if (this._conference == null)
            {
                return HttpNotFound();
            }

            var command = new UnpublishConference { AggregateRootId = this._conference.Id };
            var result = await ExecuteCommandAsync(command);

            if (!result.IsSuccess())
            {
                throw new InvalidOperationException(result.GetErrorMessage());
            }

            return RedirectToAction("Index", new { slug = this._conference.Slug, accessCode = this._conference.AccessCode });
        }
 public void Handle(ICommandContext context, UnpublishConference command)
 {
     context.Get <Conference>(command.AggregateRootId).Unpublish();
 }