public VoteCount GetVotes(MikiContext context) { VoteCount c = new VoteCount(); c.Upvotes = context.Votes.Where(x => x.Id == Id && x.PositiveVote == true).Count(); c.Downvotes = context.Votes.Where(x => x.Id == Id && x.PositiveVote == false).Count(); return(c); }
public async Task <VoteCount> GetVotesAsync(MikiContext context) { VoteCount c = new VoteCount(); c.Upvotes = await context.Votes .Where(x => x.Id == Id && x.PositiveVote == true) .CountAsync(); c.Downvotes = await context.Votes .Where(x => x.Id == Id && x.PositiveVote == false) .CountAsync(); return(c); }