View Single Post
  #2 (permalink)  
Old October 16th, 2010, 07:29 AM
ajameson ajameson is offline
Registered User
Join Date: Oct 2010
Location: Zürich
Posts: 8
Thanks: 0
Thanked 1 Time in 1 Post

Something else that needs sorted on the FindByLocation() method is the lambda expression.

var dinners = from dinner in FindUpcomingDinners()
              join i in NearestDinners(latitude, longitude)
              on dinner.DinnerID equals i.DinnerID
              select dinner;
Will highlight an error on

NearestDinners(latitude, longitude)
unless you include the following method (in the downloaded final solution this method is included immediately below the public static double DistanceBetween() stub function in DinnerRepository.cs)

public IQueryable<Dinner> NearestDinners(double latitude, double longitude)
    return from d in entities.Dinners
           where DistanceBetween(latitude, longitude, d.Latitude, d.Longitude) < 100
           select d;