public async Task <IActionResult> PutComments(Guid id, Comments comments) { if (id != comments.Id) { return(BadRequest()); } _context.Entry(comments).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CommentsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutPost([FromRoute] Guid id, [FromRoute] Post post) { if (id != post.Id) { return(BadRequest()); } _context.Entry(post).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PostExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }