public IHttpActionResult PutParkCells(int id, ParkCells parkCells) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } if (id != parkCells.id) { return(BadRequest()); } db.Entry(parkCells).State = EntityState.Modified; try { db.SaveChanges(); } catch (DbUpdateConcurrencyException) { if (!ParkCellsExists(id)) { return(NotFound()); } else { throw; } } return(StatusCode(HttpStatusCode.NoContent)); }
public void UpdateStateParkCells(RecordRequest record) { // ALQU DIS ParkCells parkcell = db.ParkCells.Find(record.idCell); parkcell.state = "OCUP"; parkcell.license = record.license; db.Entry(parkcell).State = EntityState.Modified; db.SaveChanges(); }
public IHttpActionResult GetParkCells(int id) { ParkCells parkCells = db.ParkCells.Find(id); if (parkCells == null) { return(NotFound()); } return(Ok(parkCells)); }
public IHttpActionResult PostParkCells(ParkCells parkCells) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } db.ParkCells.Add(parkCells); db.SaveChanges(); return(CreatedAtRoute("DefaultApi", new { id = parkCells.id }, parkCells)); }
public void UpdateStateParkCellsQuit(RecordRequest record, int id) { // ALQU DIS ParkCells parkcell = db.ParkCells.Find(record.idCell); Record rq = db.Record.Find(id); rq.timeOut = DateTime.UtcNow.ToLocalTime(); parkcell.state = "DISP"; parkcell.license = null; db.Entry(parkcell).State = EntityState.Modified; db.Entry(rq).State = EntityState.Modified; db.SaveChanges(); }
public IHttpActionResult DeleteParkCells(int id) { ParkCells parkCells = db.ParkCells.Find(id); if (parkCells == null) { return(NotFound()); } db.ParkCells.Remove(parkCells); db.SaveChanges(); return(Ok(parkCells)); }