Exemple #1
0
 public static bool PerformAlquiler(BindingList <Model.ListaAlquiler> Lista, string UserId)
 {
     using (EntityConnection con = conexion())
     {
         Model.WIZELLEntities model = new Model.WIZELLEntities(con);
         foreach (Model.ListaAlquiler linea in Lista)
         {
             Model.AlquilerTrans Linea2 = new Model.AlquilerTrans();
             Linea2.IdJuego      = linea.IdJuego;
             Linea2.UserId       = UserId;
             Linea2.FechaSalida  = linea.FechaSalida;
             Linea2.FechaEntrega = linea.FechaEntrega;
             model.AlquilerTrans.Add(Linea2);
         }
         try
         {
             model.SaveChanges();
             return(true);
         }
         catch (Exception ex)
         {
             return(false);
         }
     }
 }
Exemple #2
0
 public static bool NuevoUser(Model.Usuarios Users)
 {
     using (EntityConnection con = conexion())
     {
         Model.WIZELLEntities model = new Model.WIZELLEntities(con);
         Model.Usuarios       User2 = new Model.Usuarios();
         if (model.Usuarios.Where(x => x.UserId == Users.UserId).Any())
         {
             User2            = model.Usuarios.Where(x => x.UserId == Users.UserId).FirstOrDefault();
             User2.Nombre     = Users.Nombre;
             User2.Apellido   = Users.Apellido;
             User2.telefono   = Users.telefono;
             User2.direccion  = Users.direccion;
             User2.estatus    = Users.estatus;
             User2.Contrasena = Users.Contrasena;
             User2.Tipo       = Users.Tipo;
         }
         else
         {
             model.Usuarios.Add(Users);
         }
         try
         {
             model.SaveChanges();
             return(true);
         }
         catch (Exception ex)
         {
             return(false);
         }
     }
 }
Exemple #3
0
        public static string NuevoJuego(Model.Catalogo Juego)
        {
            string resultado = "";

            using (EntityConnection con = conexion())
            {
                Model.WIZELLEntities        model    = new Model.WIZELLEntities(con);
                IQueryable <Model.Catalogo> Catalogo = model.Catalogo.Where(x => x.Titulo == Juego.Titulo && x.Consola == Juego.Consola);
                if (!Catalogo.Any())
                {
                    model.Catalogo.Add(Juego);
                }
                else
                {
                    Model.Catalogo Catalogo2 = Catalogo.First();
                    Catalogo2.Cantidad = Juego.Cantidad;
                    if (Juego.Cantidad == 0)
                    {
                        bool Estatus = Catalogo.First().Estatus;
                        Estatus = Juego.Estatus;
                    }
                }
                model.SaveChanges();
                return(resultado);
            }
        }