public async Task <IHttpActionResult> PutPROCESSOR(int id, PROCESSOR pROCESSOR) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != pROCESSOR.ID) { return(BadRequest()); } db.Entry(pROCESSOR).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!PROCESSORExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> PostPROCESSOR(PROCESSOR pROCESSOR) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.PROCESSOR.Add(pROCESSOR); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = pROCESSOR.ID }, pROCESSOR)); }
public async Task <IHttpActionResult> DeletePROCESSOR(int id) { PROCESSOR pROCESSOR = await db.PROCESSOR.FindAsync(id); if (pROCESSOR == null) { return(NotFound()); } db.PROCESSOR.Remove(pROCESSOR); await db.SaveChangesAsync(); return(Ok(pROCESSOR)); }