public async Task <IActionResult> PutHelpRequestComment([FromRoute] int id, [FromBody] HelpRequestComment helpRequestComment) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != helpRequestComment.Id) { return(BadRequest()); } _context.Entry(helpRequestComment).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!HelpRequestCommentExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostHelpRequestComment([FromBody] HelpRequestComment helpRequestComment) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.HelpRequestComment.Add(helpRequestComment); await _context.SaveChangesAsync(); return(CreatedAtAction("GetHelpRequestComment", new { id = helpRequestComment.Id }, helpRequestComment)); }