///<inheritdoc/> public void Update(int oldKey, AllVotes element) { var oldVote = this.GetOne(oldKey); oldVote = element; this.db.SaveChanges(); }
///<inheritdoc/> public bool UpdateVote(int oldId, AllVotes newVote) { try { this.allVotesRepo.Update(oldId, newVote); return(true); } catch (Exception) { return(false); } }
public void Reset(IEnumerable <Song> songs, Song currentlyPlaying) { Logger.LogDebug("PartyService: Reset"); Console.WriteLine("PartyService: Reset"); AllSongs.Clear(); foreach (Song song in songs) { AllSongs.Add(song); } AllVotes.Clear(); CanVote = true; CurrentlyPlaying = currentlyPlaying; SongListingStream.OnNext(GenerateSongListing(AllSongs, CurrentlyPlaying)); VotingResultsStream.OnNext(GenerateVotingResults(AllSongs, AllVotes, CanVote)); }
/// <summary> /// Increments the associated values in the AllVotes entry, based on what this OneVote has voted for. /// </summary> /// <param name="vote">The OneVote object to be used to update the values in the AllVotes entry that belongs to it</param> void AddUsersChoiceToAllVotes(OneVote vote) { AllVotes allVoteToSaveChoise = this.allVotesLogic.GetOneVote(vote.VoteID); switch (vote.Choice) { case 0: allVoteToSaveChoise.YesVotes += 1; this.allVotesLogic.UpdateVote(allVoteToSaveChoise.VoteID, allVoteToSaveChoise); break; case 1: allVoteToSaveChoise.NoVotes += 1; this.allVotesLogic.UpdateVote(allVoteToSaveChoise.VoteID, allVoteToSaveChoise); break; default: allVoteToSaveChoise.AbsentionVotes += 1; this.allVotesLogic.UpdateVote(allVoteToSaveChoise.VoteID, allVoteToSaveChoise); break; } }
public void UpdateVote(int oldId, [FromBody] AllVotes vote) { this.allVotesLogic.UpdateVote(oldId, vote); }
public ActionResult CreateVote([FromBody] AllVotes vote) { this.allVotesLogic.CreateVote(vote); return(Ok()); }
///<inheritdoc/> public void Add(AllVotes element) { db.Add(element); db.SaveChanges(); }
///<inheritdoc/> public bool CreateVote(AllVotes vote) { this.allVotesRepo.Add(vote); return(true); }