public IHttpActionResult PostRadiusEntry(RadiusEntry radiusEntry) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.RadiusEntries.Add(radiusEntry); try { db.SaveChanges(); } catch (DbUpdateException) { if (RadiusEntryExists(radiusEntry.id)) { return(Conflict()); } else { throw; } } return(CreatedAtRoute("DefaultApi", new { id = radiusEntry.id }, radiusEntry)); }
public IHttpActionResult PutRadiusEntry(long id, RadiusEntry radiusEntry) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != radiusEntry.id) { return(BadRequest()); } db.Entry(radiusEntry).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!RadiusEntryExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public IHttpActionResult GetRadiusEntry(long id) { RadiusEntry radiusEntry = db.RadiusEntries.Find(id); if (radiusEntry == null) { return(NotFound()); } return(Ok(radiusEntry)); }
public IHttpActionResult DeleteRadiusEntry(long id) { RadiusEntry radiusEntry = db.RadiusEntries.Find(id); if (radiusEntry == null) { return(NotFound()); } db.RadiusEntries.Remove(radiusEntry); db.SaveChanges(); return(Ok(radiusEntry)); }