public async Task <IHttpActionResult> PutInfoSup(int id, InfoSup infoSup) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != infoSup.idInfo) { return(BadRequest()); } db.Entry(infoSup).State = EntityState.Modified; try { await db.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!InfoSupExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public async Task <IHttpActionResult> GetInfoSup(int id) { InfoSup infoSup = await db.InfoSups.FindAsync(id); if (infoSup == null) { return(NotFound()); } return(Ok(infoSup)); }
public async Task <IHttpActionResult> PostInfoSup(InfoSup infoSup) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.InfoSups.Add(infoSup); await db.SaveChangesAsync(); return(CreatedAtRoute("DefaultApi", new { id = infoSup.idInfo }, infoSup)); }
public async Task <IHttpActionResult> DeleteInfoSup(int id) { InfoSup infoSup = await db.InfoSups.FindAsync(id); if (infoSup == null) { return(NotFound()); } db.InfoSups.Remove(infoSup); await db.SaveChangesAsync(); return(Ok(infoSup)); }