public void addData()
 {
     for (int i = 1; i <= 100; i++)
     {
         var newItem = new tbl_Post
         {
             Title = "Mohammad",
             Body  = "bensaeed"
         };
         _db.tbl_Post.Add(newItem);
     }
     _db.SaveChanges();
 }
Example #2
0
        public void StartOperation()
        {
            string CurrentClientIP = ClientIPaddress();

            //GetLocationIPINFO(CurrentClientIP);
            GetLocationIPINFOFrom_IpApi(CurrentClientIP);
            var newItem = new tbl_Action
            {
                ActionTime  = TimeNow(),
                DateSystem  = TodayDate(),
                Browser     = ClientBrowser(),
                Device      = ClientDeviceType(),
                IP_Address  = CurrentClientIP,
                HostName    = ClientHostName(),
                Country     = NewInfoIF.country,
                asn         = NewInfoIF.@as,
                city        = NewInfoIF.city,
                countryCode = NewInfoIF.countryCode,
                isp         = NewInfoIF.isp,
                lat         = Convert.ToString(NewInfoIF.lat),
                lon         = Convert.ToString(NewInfoIF.lon),
                org         = NewInfoIF.org,
                query       = NewInfoIF.query,
                region      = NewInfoIF.region,
                regionName  = NewInfoIF.regionName,
                Status      = NewInfoIF.status,
                timezone    = NewInfoIF.timezone,
                zip         = NewInfoIF.zip,
                district    = NewInfoIF.district,
                mobile      = NewInfoIF.mobile == true ? "1" : "0",
                proxy       = NewInfoIF.proxy == true ? "1" : "0",
                reverse     = NewInfoIF.reverse
            };

            _db.tbl_Action.Add(newItem);
            _db.SaveChanges();
        }