Esempio n. 1
0
        public void insert()
        {
            PostgresqlRepository <User> repouser = new PostgresqlRepository <User>();



            repouser.Insert(new User()
            {
                Email    = "*****@*****.**",
                Login    = "******",
                Name     = "bartek",
                Password = "******",
                Phone    = "731",
                Surname  = "Zapa"
            });
        }
        public int Reptile(Dictionary <string, List <CarEntity> > skrillex)
        {
            PostgresqlRepository <Carsbrand> repouser = new PostgresqlRepository <Carsbrand>();

            foreach (KeyValuePair <string, List <CarEntity> > item in skrillex)
            {
                Carsbrand ent = createCarEntity(item.Value.First());

                repouser.Insert(ent);
            }


            /* [ foreach (  )
             *      { BMW,  List< CarEntity, CarEntity, CarEntity ... > },
             *      { Seat,  List< CarEntity, CarEntity, CarEntity ... > }
             * ]
             */

            return(1);
        }
Esempio n. 3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            var connectionString = Configuration.GetSection("DbConnection").Value;

            var repository = new PostgresqlRepository(connectionString);

            repository.Init();
            services.AddSingleton <IMessagesRepository>(repository);

            services.AddCors();

            services.AddWebSocketManager();

            services.AddControllers();

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Version = "V1", Title = "Messages API"
                });
            });
        }
Esempio n. 4
0
        public int Fatality(int numRows)
        {
            Random raiden = new Random();

            for (int i = 50; i < numRows; i++)  // FROM 50 !
            {
                //52.7612628 sz       52.8785255
                //15.2662996 dl       15.5325925

                const string chars = "0123456789";

                string coordinateXfrom = string.Empty;
                string coordinateYfrom = string.Empty;

                string coordinateXto = string.Empty;
                string coordinateYto = string.Empty;

                coordinateXfrom += "52.";
                coordinateYfrom += "15.";

                coordinateXto += "52.";
                coordinateYto += "15.";

                for (int j = 0; j < 8; j++) // create 52.XXXXXXX, 15.XXXXXXXXX   FROM
                {
                    int randomAfterPeriod = raiden.Next(0, chars.Length - 1);

                    coordinateXfrom += chars[randomAfterPeriod];
                    coordinateYfrom += chars[randomAfterPeriod];
                }


                for (int j = 0; j < 8; j++) // create 52.XXXXXXX, 15.XXXXXXXXX   TO
                {
                    int randomAfterPeriod = raiden.Next(0, chars.Length - 1);

                    coordinateXto += chars[randomAfterPeriod];
                    coordinateYto += chars[randomAfterPeriod];
                }


                string Email     = FinishHim.GetRandomWord(8);
                string Login     = FinishHim.GetRandomWord(5);
                string Name      = FinishHim.GetRandomWord(5);
                string Passoword = FinishHim.GetRandomWord(5);
                string Surname   = FinishHim.GetRandomWord(5);
                string phone     = FinishHim.GetRandomWord(5);

                User testUser = new User()
                {
                    Email    = Email + i,
                    Login    = Login + i,
                    Name     = Name + i,
                    Password = Passoword + i,
                    Surname  = Surname + i,
                    Phone    = phone + i,
                };


                Userslocation location1 = new Userslocation();

                location1.Coordinatesfrom = coordinateXfrom + ", " + coordinateYfrom;
                location1.Coordinatesto   = coordinateXto + ", " + coordinateYto;

                testUser.Userslocations.Add(location1);


                PostgresqlRepository <User> repouser = new PostgresqlRepository <User>();
                repouser.Insert(testUser);
            }

            return(1);
        }