Exemplo n.º 1
0
 //uj VonalBuszSofor
 public void Post([FromBody] VonalBuszSofor newBusLineDriver)
 {
     using (trafficEntities db = new trafficEntities())
     {
         db.VonalBuszSofors.Add(newBusLineDriver);
         db.SaveChanges();
     }
 }
Exemplo n.º 2
0
 public void Post([FromBody] Felszalla busesOnTheRoad)
 {
     using (trafficEntities db = new trafficEntities())
     {
         db.Felszallas.Add(busesOnTheRoad);
         db.SaveChanges();
     }
 }
Exemplo n.º 3
0
 public void Post([FromBody] Uzenet newMessage)
 {
     using (trafficEntities db = new trafficEntities())
     {
         db.Uzenets.Add(newMessage);
         db.SaveChanges();
     }
 }
Exemplo n.º 4
0
 public void Put(int id, [FromBody] Garaz bus)
 {
     using (trafficEntities dbContext = new trafficEntities())
     {
         var entity = dbContext.Garazs.FirstOrDefault(e => e.buszId == id);
         entity.buszId        = bus.buszId;
         entity.buszAllapotId = bus.buszAllapotId.Value;
         entity.datum         = bus.datum.Value;
         dbContext.SaveChanges();
     }
 }
Exemplo n.º 5
0
 public void Put(int id, [FromBody] Felszalla busesOnTheRoad)
 {
     using (trafficEntities dbContext = new trafficEntities())
     {
         var entity = dbContext.Felszallas.FirstOrDefault(e => e.buszId == id);
         entity.buszId  = busesOnTheRoad.buszId;
         entity.vonalId = busesOnTheRoad.vonalId;
         entity.lat     = busesOnTheRoad.lat;
         entity.lon     = busesOnTheRoad.lon;
         entity.datum   = busesOnTheRoad.datum;
         dbContext.SaveChanges();
     }
 }
Exemplo n.º 6
0
        public ActionResult addNewBusLineDriver(VonalBuszSofor newBusLineDriver)
        {
            using (trafficEntities db = new trafficEntities())
            {
                db.VonalBuszSofors.Add(newBusLineDriver);

                db.SaveChanges();
            }

            ModelState.AddModelError(string.Empty, "Server Error. Please contact administrator.");

            return(View("addNewBusLineDriver", new VonalBuszSofor()));
        }
Exemplo n.º 7
0
        public IHttpActionResult Delete(int id)
        {
            if (id <= 0)
            {
                return(BadRequest("Not a valid busLineDriverId"));
            }

            using (var DB = new trafficEntities())
            {
                var student = DB.VonalBuszSofors
                              .Where(s => s.vonalbuszsoforId == id)
                              .FirstOrDefault();

                DB.Entry(student).State = System.Data.Entity.EntityState.Deleted;
                DB.SaveChanges();
            }

            return(Ok());
        }