public async Task <DtoVoto> Handle(CreateVotoCommand request, CancellationToken cancellationToken)
        {
            var carta     = Context.Carta.Any(c => c.Id == request.CartaId);
            var historial = Context.Historial.Any(c => c.Id == request.CartaId);
            var usuario   = Context.Usuario.Any(c => c.Id == request.CartaId);

            if (!(carta && historial && usuario))
            {
                return(null);
            }
            Voto voto;

            Context.Voto.Add(voto = new Voto {
                CartaId = request.CartaId, HistorialId = request.HistorialId, UsuarioId = request.UsuarioId
            });
            await SaveChangesAsync();

            return(AutoMapperHelper.MapDto <Voto, DtoVoto>(voto));
        }
 public async Task <DtoVoto> Handle(GetVotoQuery request, CancellationToken cancellationToken)
 {
     return(await Task.FromResult(AutoMapperHelper.MapDto <Voto, DtoVoto>(Context.Voto.FirstOrDefault(c => c.Id == request.Id))).ConfigureAwait(false));
 }
 public async Task <DtoHistorial> Handle(GetHistorialQuery request, CancellationToken cancellationToken)
 {
     return(await Task.FromResult(AutoMapperHelper.MapDto <Historial, DtoHistorial>(Context.Historial.FirstOrDefault(c => c.Id == request.Id))).ConfigureAwait(false));
 }