public CastleByDistanceModel GetNearestCastle(List <string> castles, double lat, double lng) { return(Castles.Where(c => castles.Contains(c.Id)).Select(c => new CastleByDistanceModel { Castle = c, Distance = MapHelpers.GetDistance(c.Position.Lat, c.Position.Lng, lat, lng) }).OrderBy(d => d.Distance).First()); }
public List <string> GetOpponentCastlesId() { var myArmy = GetMyArmy(); return(Castles.Where(e => e.Army != myArmy).Select(e => e.Id).ToList()); }
public List <CastleStateModel> GetMyCastles() { var myArmy = GetMyArmy(); return(Castles.Where(e => e.Army == myArmy).ToList()); }