public async Task<IHttpActionResult> PutLineTask(int id, LineTask lineTask) { if (!ModelState.IsValid) { return BadRequest(ModelState); } if (id != lineTask.Id) { return BadRequest(); } db.Entry(lineTask).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!LineTaskExists(id)) { return NotFound(); } else { throw; } } return StatusCode(HttpStatusCode.NoContent); }
public async Task<IHttpActionResult> PostLineTask(LineTask lineTask) { if (!ModelState.IsValid) { return BadRequest(ModelState); } db.LineTasks.Add(lineTask); await db.SaveChangesAsync(); return CreatedAtRoute("DefaultApi", new { id = lineTask.Id }, lineTask); }