コード例 #1
0
        static void Main(string[] args)
        {
            Documents        doc = new Documents();
            RepositoryPeople rep = new RepositoryPeople(doc);

            //People p = new People();
            //p.Active = true;
            //p.Name = "Pessoa 2";

            //var result = rep.Insert(p).Result;

            //var get = rep.FindAsync("7a6afeec-a378-46f1-a3ad-d25fa6b99fec").Result;
            //get.Name = "Alterando registro 7a6afeec-a378-46f1-a3ad-d25fa6b99fec";

            ///var r = rep.UpdateAsync(get).Result;
            ///

            var lista0 = rep.AllAsync(c => c.Active)
                         .Result;

            var lista1 = rep.AllAsync(c => c.Active == false, o => o.Name)
                         .Result;

            var lista3 = rep.AllAsync(c => c.Active, o => o.Name, s => new { s.Id, s.Name })
                         .Result;
        }
コード例 #2
0
        static void Main(string[] args)
        {
            IConfig  config  = new Config("mongodb://localhost", "database", false, false);
            IConnect connect = new Connect(config);
            RepositoryPeopleContract repPeople = new RepositoryPeople(connect);

            People people = new People();

            people.Name = "Fúlvio";

            repPeople.Add(people);


            Console.WriteLine("Hello World!");
        }
コード例 #3
0
        public static void Main(string[] args)
        {
            IConfig  config  = new Config("mongodb://localhost:27017", "db");
            IConnect connect = new Connect(config);
            //RepositoryCreditImpl rep = new RepositoryCredit(connect);
            RepositoryPeopleImpl rep = new RepositoryPeople(connect);

            bool result = rep.UpdateAll(a => a.Created != null,
                                        Builders <People> .Update.Set(_ => _.Value, 2));

            var r0 = rep.Query().Select(a => new { a.Id, a.Name });
            var r1 = r0.ToList();


            System.Console.WriteLine($"{result}");

            //Credit model = new Credit();
            //model.Name = "redeTV.com.br";
            //rep.Add(model);

            //var _id = rep.CreateObjectId("58ba1fbcaa0ae801dc886dec");
            //Credit model = rep.Find(x => x.Id == _id);
            //model.Name += " Alteração";

            //rep.Edit(x => x.Id == _id, model);

            //var b = rep.Builder()
            //    .Set(a => a.Name, "alterando")


            //rep.Update(x => x.Id == _id, b);

            //System.Console.WriteLine(rep.Count(a => a.Name.Contains("b")));

            //var r = rep.All(a => a.Name.Contains("o"), a => a.Name)
            //    .ToList();

            //foreach (var item in rep.List(a => a.Name))
            //{
            //    System.Console.WriteLine($"{item.Id} - {item.Name}");
            //}

            System.Console.ReadKey();
        }
コード例 #4
0
 public static string GetConditionPlanet(this RepositoryPeople input, string name, string population)
 {
     return(FunctionsPeopleService.GetConditionPlanet(name, population));
 }
コード例 #5
0
 public static string GetConditionSpecie(this RepositoryPeople input, string name)
 {
     return(FunctionsPeopleService.GetConditionSpecie(name));
 }