コード例 #1
0
        private async Task InvokeUpdateBeerByIdCommandAsync(IContext context, UpdateBeerByIdCommand command)
        {
            var triggeredEvent = new UpdateBeerByIdEvent(command.Id, command.Beer);

            var(IsSuccess, RowsAffected) = await actorManager.RequestAsync <BeerEventActor, (bool, int)>(triggeredEvent);

            context.Respond((IsSuccess, RowsAffected));
        }
コード例 #2
0
ファイル: BeerEventActor.cs プロジェクト: hr101191/.net-core
        private async Task InvokeUpdateBeerByIdEventAsync(IContext context, UpdateBeerByIdEvent e)
        {
            var parameters = new DynamicParameters();

            parameters.Add("Id", e.Id);
            parameters.Add("Name", e.Beer.Name);
            parameters.Add("Company", e.Beer.Company);
            parameters.Add("Style", e.Beer.Style);
            var(IsSuccess, RowsAffected) = await dataAccessService.ExecuteAsync("Update Beer set Name = @Name, Company = @Company, Style = @Style where Id = @Id", false, parameters);

            context.Respond((IsSuccess, RowsAffected));
        }