public async Task GetDeleteLast() { List <Candidate> candidatess = await _candidatesService.GetCandidatesList(); List <Vote> votess = await _votesService.GetVotesList(); if (candidatess.Count > 0) { Candidate cand = await _candidatesService.RemoveLastAsync(); foreach (Vote v in votess) { if (v.Candidate_id == cand.Id) { await _votesService.DeleteVote(v.Id); } } } }
public IActionResult DeleteFine([FromRoute] int id) { _voteService.DeleteVote(id); return(Ok()); }