예제 #1
0
        private async Task <UserLogin> GenerateUserLogin(User user)
        {
            var ip = await _clientInfoDetection.Ip();

            var location = await _clientInfoDetection.Location(ip);

            var deviceInfo = await _clientInfoDetection.DeviceInfo();

            return(new UserLogin()
            {
                UserId = user.Id,
                User = user,
                Device = deviceInfo.Device,
                DeviceType = deviceInfo.DeviceType,
                DeviceFamily = deviceInfo.DeviceFamily,
                Browser = deviceInfo.Browser,
                BrowserFamily = deviceInfo.BrowserFamily,
                UserAgent = deviceInfo.UserAgent,
                ClientIp = IPAddress.Parse(ip),
                Latitude = location.Latitude,
                Longitude = location.Longitude,
                Country = location.CountryName,
                Region = location.RegionName,
                City = location.CityName,
                DeletedAt = null,
                CreatedAt = DateTime.Now,
                UpdatedAt = DateTime.Now,
            });
        }
예제 #2
0
        public async Task <IActionResult> Handle()
        {
            var ip = await _clientInfoDetection.Ip();

            return(Ok(new {
                Ip = ip,
                Location = await _clientInfoDetection.Location(ip),
                DeviceInfo = await _clientInfoDetection.DeviceInfo()
            }));
        }