public async Task Put(int id, [FromBody] Poll poll) { var existingPoll = await _votingContext.Polls.FirstOrDefaultAsync(x => x.Id == id); _votingContext.Remove(existingPoll); _votingContext.Add(poll); await _votingContext.SaveChangesAsync(); }
public async Task Put(int id, [FromBody] Poll poll) { var existingPoll = await _votingContext.Polls.FirstOrDefaultAsync(x => x.Id == id); _votingContext.Remove(existingPoll); _votingContext.Add(poll); await _votingContext.SaveChangesAsync(); }