Esempio n. 1
0
    public Task Handle(VotePlaced message, IMessageHandlerContext context)
    {
        if (!Data.Started)
        {
            Data.Candidate = message.Candidate;
            Data.Started = true;
        }
        Data.Count++;

        var trackZipCode = new TrackZipCode
        {
            ZipCode = message.ZipCode
        };
        return context.Send(trackZipCode);
    }
Esempio n. 2
0
    public async Task Handle(TrackZipCode message, IMessageHandlerContext context)
    {
        if (!Data.Started)
        {
            await RequestTimeout<CloseVoting>(context, DateTime.UtcNow.AddMinutes(1))
                .ConfigureAwait(false);
            Data.ZipCode = message.ZipCode;
            Data.Started = true;
        }

        Data.Count++;

        var trackZipCodeReply = new TrackZipCodeReply
        {
            ZipCode = Data.ZipCode,
            CurrentCount = Data.Count
        };
        await context.Reply(trackZipCodeReply)
            .ConfigureAwait(false);
    }