public void SetPosition() { var userList = _manager.GetGpsItems("2"); foreach (var item in userList) { if (item != null) { DateTime start = new DateTime(2020, 12, 1); Random r = new Random(); Road road = Common.Utils.DeserializeObject <Road>(item.LoacationInfo); for (int i = 0; i < 50; i++) { List <GPSItem> list = new List <GPSItem>(); double lat, lng; road.GetPosi(out lat, out lng); item.Lat = (decimal)lat; item.Lng = (decimal)lng; item.LastUpdateTime = start; start = start.AddMinutes(r.Next(27, 31)).AddSeconds(r.Next(0, 30)); list.Add(item); _manager.UpdateLoc(list); } } } }