public async Task <IActionResult> PutPost(int id, Post post) { if (id != post.PostId) { return(BadRequest()); } _context.Entry(post).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PostExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutTag(int id, Tag tag) { if (id != tag.TagId) { return(BadRequest()); } _context.Entry(tag).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!TagExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }