I am quite new to Linq to Entity and having some trouble.
Here's my Search repository:
public static List<Centre> Search(Search search)
{
using (var context = new MeetingRoomsContext())
{
var query = context.Centres
.Include("Geo")
.OrderBy( NEED HELP WITH THIS PART )
return query.ToList();
}
}
I am getting a search object which contains co-ordinates like this:
Search.LongLat = "(-6.265275, 53.334442)"
I need to break that out and do some maths against the co-ordinates in the DB in order to order results by the closest to the searched point for first.
In mathematical terms it would be pythagoras:
squareRootOf((difference in latitude * difference in latitude) +
(difference in longitude * difference in longitude))
Really haven't a clue how to do this. Any help appreciated greatly