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()); }
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> PutAuthor(int id, Author author) { if (id != author.AuthorID) { return(BadRequest()); } _context.Entry(author).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!AuthorExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PutComments(int id, BlogDataModel.Comments comments) { if (id != comments.CommentID) { return(BadRequest()); } _context.Entry(comments).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!CommentsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }