public IHttpActionResult PutHoSoXNBN(int id, HoSoXNBN hoSoXNBN) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != hoSoXNBN.ID) { return(BadRequest()); } db.Entry(hoSoXNBN).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!HoSoXNBNExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult PostHoSoXNBN(HoSoXNBN hoSoXNBN) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.HoSoXNBNs.Add(hoSoXNBN); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = hoSoXNBN.ID }, hoSoXNBN)); }
public IHttpActionResult DeleteHoSoXNBN(int id) { HoSoXNBN hoSoXNBN = db.HoSoXNBNs.Find(id); if (hoSoXNBN == null) { return(NotFound()); } db.HoSoXNBNs.Remove(hoSoXNBN); db.SaveChanges(); return(Ok(hoSoXNBN)); }