// PUT: api/PoliceOfficers/5 public async Task <IHttpActionResult> Put([FromODataUri] int key, InvestigationReport investigationReport) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (key != investigationReport.Id) { return(BadRequest()); } db.Entry(investigationReport).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InvestigationReportExists(key)) { return(NotFound()); } else { throw; } } return(Updated(investigationReport)); }
// POST: api/PoliceOfficers public async Task <IHttpActionResult> Post(InvestigationReport investigationReport) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.InvestigationReports.Add(investigationReport); await db.SaveChangesAsync(); return(Created(investigationReport)); }