public void Barajar()
        {
            Random op = new Random();
            int    insertar;

            for (int i = 0; i < 1000; i++)
            {
                insertar = op.Next(Cartas.Count() - 1);
                Carta nueva = Cartas.ElementAt(0);
                Cartas.Remove(nueva);
                Cartas.Insert(insertar, nueva);
            }
        }
Example #2
0
        public MainContext()
        {
            var connectionString = "mongodb://localhost/?safe=true";
            var server           = MongoServer.Create(connectionString);

            database = server.GetDatabase("cardMage");

            Cartas       = database.GetCollection <Carta>("cartas");
            Baralhos     = database.GetCollection <Baralho>("baralhos");
            UserProfiles = database.GetCollection <UserProfile>("usuarios");

            if (Cartas.Count() <= 0)
            {
                Baralhos.RemoveAll();
                Cartas.RemoveAll();
                UserProfiles.RemoveAll();
                Seed();
            }
        }