public async Task SendVoteAsync(string community, string user)
        {
            var c = community.ToLowerInvariant();
            var voto = new Voto
            {
                Comunidad = c,
                Usuario = user,
            };

            await _messageQueue.AddMessageAsync(voto.AsQueueMessage());

            await Task.Run(() =>
            {
                var v = (int)(MemoryCache.Get(c) ?? 0);

                MemoryCache.Set(c, ++v);
            });
        }
Beispiel #2
0
 public static CloudQueueMessage AsQueueMessage(this Voto voto)
 {
     return(new CloudQueueMessage(JsonConvert.SerializeObject(voto)));
 }