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> PutBlog(int id, Blog blog) { if (id != blog.BlogId) { return(BadRequest()); } _context.Entry(blog).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!BlogExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }