예제 #1
0
        public ActionResult RealDeleteConfirmed(int id)
        {
            Circulacion circulacion = db.CIRCULACION.Find(id);

            db.CIRCULACION.Remove(circulacion);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #2
0
 public ActionResult Edit([Bind(Include = "Id,Descripcion,Estado,FechaDeInicio,FechaDeFin")] Circulacion circulacion)
 {
     if (ModelState.IsValid)
     {
         db.Entry(circulacion).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(circulacion));
 }
예제 #3
0
 //Method that searches for a vehicle entered in the university
 public override Circulacion busquedaVehiculoBackend(string patente, Current current)
 {
     using (var scope = _serviceScopeFactory.CreateScope())
     {
         int estado = 1;
         ServerParkingUCNContext pc     = scope.ServiceProvider.GetService <ServerParkingUCNContext>();
         Circulacion             salida = new Circulacion();
         salida = pc.Circulaciones.Where(w => w.patente == patente).Where(a => a.estadoVehiculo == estado).FirstOrDefault();
         pc.SaveChanges();
         return(salida);
     }
     throw new System.NotImplementedException();
 }
예제 #4
0
        // GET: Circulacions/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Circulacion circulacion = db.CIRCULACION.Find(id);

            if (circulacion == null)
            {
                return(HttpNotFound());
            }
            return(View(circulacion));
        }
예제 #5
0
        public ActionResult DeleteConfirmed(int id)
        {
            Circulacion circulacion = db.CIRCULACION.Find(id);

            if (circulacion.Estado == "A")
            {
                circulacion.Estado = "I";
            }
            else
            {
                circulacion.Estado = "A";
            }
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
예제 #6
0
 //Method that records the departure of the vehicle
 public override Circulacion salidaVehiculo(string patente, string puertaSalida, Current current)
 {
     using (var scope = _serviceScopeFactory.CreateScope())
     {
         var dato = 0;
         ServerParkingUCNContext pc     = scope.ServiceProvider.GetService <ServerParkingUCNContext>();
         Circulacion             salida = new Circulacion();
         salida = pc.Circulaciones.Where(w => w.patente == patente).Where(a => a.estadoVehiculo == 1).FirstOrDefault();
         salida.puertaSalida   = puertaSalida;
         salida.estadoVehiculo = dato;
         salida.fechaSalida    = DateTime.Now.ToString("dd-M-yyyy");
         salida.horaSalida     = DateTime.Now.ToString("HH:mm:ss");
         pc.SaveChanges();
         return(salida);
     }
     throw new System.NotImplementedException();
 }
예제 #7
0
 //Method that records the entry of the vehicle
 public override Circulacion ingresoVehiculo(string patente, string puertaEntrada, string observacion, Current current)
 {
     using (var scope = _serviceScopeFactory.CreateScope())
     {
         var dato = 1;
         ServerParkingUCNContext pc      = scope.ServiceProvider.GetService <ServerParkingUCNContext>();
         Circulacion             ingreso = new Circulacion();
         ingreso.patente        = patente;
         ingreso.puertaEntrada  = puertaEntrada;
         ingreso.estadoVehiculo = dato;
         ingreso.observacion    = observacion;
         ingreso.fechaIngreso   = DateTime.Now.ToString("dd-M-yyyy");
         ingreso.horaIngreso    = DateTime.Now.ToString("HH:mm:ss");
         pc.Circulaciones.Add(ingreso);
         pc.SaveChanges();
         return(ingreso);
     }
     throw new System.NotImplementedException();
 }
예제 #8
0
        public ActionResult Create([Bind(Include = "Id,Descripcion,Estado,FechaDeInicio,FechaDeFin")] Circulacion circulacion)
        {
            if (ModelState.IsValid)
            {
                db.CIRCULACION.Add(circulacion);
                string mensaje = Verificar(circulacion.Id);
                if (mensaje == "")
                {
                    db.SaveChanges();
                    TempData["Type"]    = "success";
                    TempData["Message"] = "El registro se realizó correctamente";
                    return(RedirectToAction("Index"));
                }
                else
                {
                    ViewBag.Type    = "warning";
                    ViewBag.Message = mensaje;
                    return(View(circulacion));
                }
            }

            return(View(circulacion));
        }