public async Task <IActionResult> PutInvestigativeReport([FromRoute] int id, [FromBody] InvestigativeReport investigativeReport) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != investigativeReport.ReportID) { return(BadRequest()); } _context.Entry(investigativeReport).State = EntityState.Modified; try { await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InvestigativeReportExists(id)) { return(NotFound()); } else { throw; } } return(NoContent()); }
public async Task <IActionResult> PostInvestigativeReport([FromBody] InvestigativeReport investigativeReport) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.InvestigativeReports.Add(investigativeReport); await _context.SaveChangesAsync(); return(CreatedAtAction("GetInvestigativeReport", new { id = investigativeReport.ReportID }, investigativeReport)); }