public async Task <IActionResult> PutPosts(int id, Posts posts) { if (id != posts.PostsId) { return(BadRequest()); } _context.Entry(posts).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PostsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <Blogger> > DeleteBlog(int id) { var blog = await _context.Blogger.FindAsync(id); if (blog == null) { return(NotFound()); } _context.Blogger.Remove(blog); await _context.SaveChangesAsync(); return(blog); }