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)); }
public async Task <ActionResult> UpdateBeerById(long id, Beer beer) { try { var command = new UpdateBeerByIdCommand(id, beer); var(isSuccess, rowsAffected) = await _actorManager.RequestAsync <BeerCommandActor, (bool, int)>(command); if (isSuccess && rowsAffected > 0) { return(StatusCode(204)); } else if (isSuccess && rowsAffected == 0) { return(StatusCode(404)); } return(StatusCode(500)); } catch (Exception ex) { Console.WriteLine(ex.StackTrace); return(StatusCode(500)); } }