public async Task <ActionResult <PostsDetails> > PostPostsDetails(PostsDetails postsDetails) { _context.PostsDetails.Add(postsDetails); await _context.SaveChangesAsync(); return(CreatedAtAction("GetPostsDetails", new { id = postsDetails.DetailsId }, postsDetails)); }
public async Task <IActionResult> PutPostsDetails(int id, PostsDetails postsDetails) { if (id != postsDetails.DetailsId) { return(BadRequest()); } _context.Entry(postsDetails).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PostsDetailsExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }