public ActionResult Edit([Bind(Include = "CodReserva,ReservaOpera,NomHuesped,NumRoom,Checkin,Checkout,FecReg,UsrReg,Alergias,Observaciones,NotasCliente,Email")] SPA_Encabezado_Reserva sPA_Encabezado_Reserva)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sPA_Encabezado_Reserva).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sPA_Encabezado_Reserva));
 }
Example #2
0
        public ActionResult Edit(User user)
        {
            //if (ModelState.IsValid)
            //{
            //    db.Entry(user).State = EntityState.Modified;
            //    db.SaveChanges();
            //    return RedirectToAction("Index");
            //}
            //return View(user);

            if (user != null)
            {
                ConciergeEntities1 db_Aux = new ConciergeEntities1();
                var Upd = db_Aux.Users.Find(user.Id);
                if (Upd != null)
                {
                    //Actulizando datos
                    Upd.Nombre = user.Nombre;
                    Upd.Nivel  = user.Nivel;
                    Upd.Activo = user.Activo;
                    db_Aux.Entry(Upd).CurrentValues.SetValues(Upd);
                    db_Aux.SaveChanges();
                }
                return(RedirectToAction("Index"));
            }
            return(View(user));
        }
Example #3
0
 public ActionResult EditPassword(User user, String PasswordConfirm)
 {
     //if (ModelState.IsValid)
     //{
     //    db.Entry(user).State = EntityState.Modified;
     //    db.SaveChanges();
     //    return RedirectToAction("Index");
     //}
     if (user != null)
     {
         if (user.Password == PasswordConfirm)
         {
             ConciergeEntities1 db_Aux = new ConciergeEntities1();
             var Upd = db_Aux.Users.Find(user.Id);
             if (Upd != null)
             {
                 //Actulizando datos
                 Upd.Password = user.Password;
                 db_Aux.Entry(Upd).CurrentValues.SetValues(Upd);
                 db_Aux.SaveChanges();
             }
             return(RedirectToAction("Index"));
         }
         else
         {
             ModelState.AddModelError("ConfirmPassword", "El password no coincide.");
         }
     }
     return(View(user));
 }
        public JsonResult ActualizarReserva(SPA_Encabezado_Reserva Det)
        {
            bool status = true;

            try
            {
                var enDB       = db.SPA_Detalle_Reserva.Where(x => x.CodReserva == Det.CodReserva); //Los que están en la BD para comparaciones
                var EnForm     = Det.SPA_Detalle_Reserva.Select(x => x.Numreg).ToArray();           //Cargando el valor "CodReserva" de lo que se trae
                var Nuevos     = Det.SPA_Detalle_Reserva.Where(x => x.Numreg == 0).AsEnumerable();  //Registros con valor "0"
                var Eliminados = enDB.Where(x => !EnForm.Contains(x.Numreg));
                var Aeditar    = Det.SPA_Detalle_Reserva.Where(x => x.Numreg > 0);                  //Cuando trae valores

                //Eliminando:
                db.SPA_Detalle_Reserva.RemoveRange(Eliminados);
                //Actualizando: Editando valores que vienen
                Aeditar = Aeditar.Select(c => { c.CodReserva = Det.CodReserva; return(c); }).AsEnumerable();//Agregando el CodReserva a los detalles
                foreach (var Reg in Aeditar)
                {
                    db.Entry(Reg).State = System.Data.Entity.EntityState.Modified;
                }
                //Insertando
                Nuevos = Nuevos.Select(c => { c.CodReserva = Det.CodReserva; return(c); }).AsEnumerable();//Agregando el CodReserva a los detalles
                db.SPA_Detalle_Reserva.AddRange(Nuevos);

                db.SaveChanges();

                //Actualizando el encabezado con una nueva instancia de la entidad
                ConciergeEntities1 db_Aux = new ConciergeEntities1();
                var Upd = db_Aux.SPA_Encabezado_Reserva.Find(Det.CodReserva);
                if (Upd != null)
                {
                    //Actulizando datos
                    Upd.ReservaOpera  = Det.ReservaOpera;
                    Upd.NomHuesped    = Det.NomHuesped;
                    Upd.NumRoom       = Det.NumRoom;
                    Upd.Checkin       = Det.Checkin;
                    Upd.Checkout      = Det.Checkout;
                    Upd.Alergias      = Det.Alergias;
                    Upd.Observaciones = Det.Observaciones;
                    Upd.NotasCliente  = Det.NotasCliente;
                    Upd.Email         = Det.Email;
                    db_Aux.Entry(Upd).CurrentValues.SetValues(Upd);
                    db_Aux.SaveChanges();
                }

                status = true;
            }
            catch (Exception rx)
            {
                status = false;
            }

            return(new JsonResult {
                Data = new { status = status }
            });
        }
 public ActionResult Edit([Bind(Include = "CodPick,DesPick")] TRAN_Pick_Drop tRAN_Pick_Drop)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tRAN_Pick_Drop).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tRAN_Pick_Drop));
 }
 public ActionResult Edit([Bind(Include = "Codtip,Destip")] TRAN_Tipo_Transporte tRAN_Tipo_Transporte)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tRAN_Tipo_Transporte).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(tRAN_Tipo_Transporte));
 }
 public ActionResult Edit([Bind(Include = "CodSala,DesSala,CarSala")] SPA_Salas sPA_Salas)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sPA_Salas).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sPA_Salas));
 }
 public ActionResult Edit([Bind(Include = "CodTerap,NomTerap")] SPA_Terapeutas sPA_Terapeutas)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sPA_Terapeutas).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sPA_Terapeutas));
 }
Example #9
0
 public ActionResult Edit([Bind(Include = "CodSer,NomSer,DesSer,DurSer,PreSer")] SPA_Servicios sPA_Servicios)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sPA_Servicios).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(sPA_Servicios));
 }
Example #10
0
 public ActionResult Edit([Bind(Include = "CodTour,NomTour,DesTour,DurTour,PreTourAdulto,PreTourAdultoM,PreTourNino,NotasTour,ComTour")] TOUR_Catalogo_Tour tOUR_Catalogo_Tour)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tOUR_Catalogo_Tour).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.ComTour = new SelectList(db.TOUR_Operadores, "CodCom", "NomCom", tOUR_Catalogo_Tour.ComTour);
     return(View(tOUR_Catalogo_Tour));
 }
 public ActionResult Edit([Bind(Include = "CodCom,NomCom,TelCom,EmaCom,Contacto1,Telcon1,EmaCon1,Contacto2,Telcon2,Emacon2")] TOUR_Operadores tOUR_Operadores)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tOUR_Operadores).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CodCom = new SelectList(db.TOUR_Catalogo_Tour, "CodTour", "NomTour", tOUR_Operadores.CodCom);
     return(View(tOUR_Operadores));
 }
Example #12
0
 public ActionResult Edit([Bind(Include = "CodReserva,ReservaOpera,NomHuesped,NumRoom,Checkin,Checkout,FecReg,UsrReg,Alergias,Observaciones,NotasCliente,Email,CodCom,CodTour,PaxAdul,PaxAdulM,PaxNino,Total,Fecha,Hora,ReturnTime")] TOUR_Encabezado_Reserva tOUR_Encabezado_Reserva)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tOUR_Encabezado_Reserva).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CodTour = new SelectList(db.TOUR_Catalogo_Tour, "CodTour", "NomTour", tOUR_Encabezado_Reserva.CodTour);
     ViewBag.CodCom  = new SelectList(db.TOUR_Operadores, "CodCom", "NomCom", tOUR_Encabezado_Reserva.CodCom);
     return(View(tOUR_Encabezado_Reserva));
 }
Example #13
0
 public ActionResult Edit([Bind(Include = "CodReserva,ReservaOpera,NomHuesped,NumRoom,Checkin,Checkout,FecReg,UsrReg,Alergias,Observaciones,NotasCliente,Email,TipoTran,Pickup,Dropoff,Pax,Precio,Fecha,Hora,Aerolinea,NoVuelo")] TRAN_Encabezado_Reserva tRAN_Encabezado_Reserva)
 {
     if (ModelState.IsValid)
     {
         db.Entry(tRAN_Encabezado_Reserva).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.Pickup   = new SelectList(db.TRAN_Pick_Drop, "CodPick", "DesPick", tRAN_Encabezado_Reserva.Pickup);
     ViewBag.Dropoff  = new SelectList(db.TRAN_Pick_Drop, "CodPick", "DesPick", tRAN_Encabezado_Reserva.Dropoff);
     ViewBag.TipoTran = new SelectList(db.TRAN_Tipo_Transporte, "Codtip", "Destip", tRAN_Encabezado_Reserva.TipoTran);
     return(View(tRAN_Encabezado_Reserva));
 }
Example #14
0
 public ActionResult Edit([Bind(Include = "CodReserva,Numreg,FecHoraRes,CodSer,CodSala,CodTerap,Notas,NomHues")] SPA_Detalle_Reserva sPA_Detalle_Reserva)
 {
     if (ModelState.IsValid)
     {
         db.Entry(sPA_Detalle_Reserva).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.CodReserva = new SelectList(db.SPA_Encabezado_Reserva, "CodReserva", "ReservaOpera", sPA_Detalle_Reserva.CodReserva);
     ViewBag.CodSala    = new SelectList(db.SPA_Salas, "CodSala", "DesSala", sPA_Detalle_Reserva.CodSala);
     ViewBag.CodSer     = new SelectList(db.SPA_Servicios, "CodSer", "NomSer", sPA_Detalle_Reserva.CodSer);
     ViewBag.CodTerap   = new SelectList(db.SPA_Terapeutas, "CodTerap", "NomTerap", sPA_Detalle_Reserva.CodTerap);
     return(View(sPA_Detalle_Reserva));
 }