예제 #1
0
        public List<UserModel> GetProximityUsers(string userid, double lat, double lon)
        {
            User user = uctx.GetById("Users", userid);
            if (user == null) throw new Exception(); // does not exsist

            UserLocationContext ctx = new UserLocationContext();
            List<UserLocation> proxUserLoc = ctx.GetProximityUsers(lat, lon);

            List<User> proxUsers = uctx.GetUsers(proxUserLoc);

            List<UserModel> proxUserModels = UserModel.FromEntity(proxUsers);
            return proxUserModels;
        }
예제 #2
0
 private void UpdateUserLocation(double lat, double lon, string userId)
 {
     UserLocationContext locCtx = new UserLocationContext();
     UserLocation userloc = locCtx.GetById(lat.ToString(), lon.ToString());
     if (userloc == null)
         locCtx.AddObject(new UserLocation { Latitude = lat.ToString(), Longitude = lon.ToString(), UserId = userId, LocationTime = DateTime.Now });
     else
     {
         userloc.UserId = userId;
         userloc.LocationTime = DateTime.Now;
         locCtx.UpdateObject(userloc, false);
     }
 }