public async Task <IActionResult> PutVoteforVideo([FromRoute] int id, [FromBody] VoteforVideo voteforVideo) { if (id != voteforVideo.VideoId) { return(BadRequest()); } _context.Entry(voteforVideo).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!VoteforVideoExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutCounter([FromRoute] string id, [FromBody] Counter counter) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != counter.Type) { return(BadRequest()); } _context.Entry(counter).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CounterExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> Putitem([FromRoute] int id, [FromBody] item item) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != item.UserId) { return(BadRequest()); } _context.Entry(item).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!itemExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }