public async Task <ActionResult <ParentPost> > PostParentPost(ParentPost parentPost) { _context.ParentPost.Add(parentPost); await _context.SaveChangesAsync(); return(CreatedAtAction("GetParentPost", new { id = parentPost.Id }, parentPost)); }
public async Task <IActionResult> PutParentPost(Guid id, ParentPost parentPost) { if (id != parentPost.Id) { return(BadRequest()); } _context.Entry(parentPost).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ParentPostExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }