public async Task <IHttpActionResult> PuttInstructionType(int id, tInstructionType InstructionType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != InstructionType.ID) { return(BadRequest()); } db.Entry(InstructionType).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!tInstructionTypeExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GettInstructionType(int id) { tInstructionType tInstructionType = await db.tInstructionTypes.FindAsync(id); if (tInstructionType == null) { return(NotFound()); } return(Ok(tInstructionType)); }
public async Task <IHttpActionResult> PosttInstructionType(tInstructionType InstructionType) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.tInstructionTypes.Add(InstructionType); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = InstructionType.ID }, InstructionType)); }
public async Task <IHttpActionResult> DeletetInstructionType(int id) { tInstructionType tInstructionType = await db.tInstructionTypes.FindAsync(id); if (tInstructionType == null) { return(NotFound()); } db.tInstructionTypes.Remove(tInstructionType); await db.SaveChangesAsync(); return(Ok(tInstructionType)); }