public async Task <IActionResult> PutDComment(int id, DComment dComment) { if (id != dComment.Id) { return(BadRequest()); } _context.Entry(dComment).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!DCommentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <ActionResult <DComment> > PostDComment(DComment dComment) { _context.DComments.Add(dComment); await _context.SaveChangesAsync(); return(CreatedAtAction("GetDComment", new { id = dComment.Id }, dComment)); }
public List <DComment> AddComment(DComment newComment) { _commentLibrary.Add(newComment); //map and add to database return(_commentLibrary); }