public async Task <bool> AddPostUpDownVoteAsync(UpDownVote newUpDownVote) { var votes = _context.UpDownVotes; var vote = new UpDownVote { PostId = newUpDownVote.PostId, UniqueIdentifier = newUpDownVote.UniqueIdentifier, DateVoted = newUpDownVote.DateVoted, PosterId = newUpDownVote.PosterId, VoteIncrement = newUpDownVote.VoteIncrement, VoterId = newUpDownVote.VoterId, UpDownVoteId = newUpDownVote.UpDownVoteId }; await votes.AddAsync(vote); await _context.SaveChangesAsync(); return(true); }
public async Task <bool> AddPostUpDownVoteAsync(UpDownVote newUpDownVote) => await new Data.Repository.UpDownVotes(_context).AddPostUpDownVoteAsync(newUpDownVote);
/// <summary> /// Sends an upload request with a single song and either an upvote or a downvote. /// The server will check the database for that song. If the song exists, it will /// add the vote to it, otherwise it will add the song to the server and save it /// with the vote. /// /// The response will contain a single SongParameters item with the song and it's score /// </summary> /// <param name="song">Song to upload</param> /// <param name="upOrDownvote">Vote. True if an upvote, false otherwise.</param> /// <param name="userInfo">The user authentication token</param> public BBRequest(SongParameters song, bool upOrDownvote, UserToken userInfo) { requestType = new UpDownVote(song, upOrDownvote, userInfo); }