Пример #1
0
        public static Model.BusStop ConvertFromDomain(DomainModel.BusStop source)
        {
            var destin = new Model.BusStop();

            destin.Id        = source.Id;
            destin.Title     = source.Title;
            destin.Latitude  = source.Latitude;
            destin.Longitude = source.Longitude;
            destin.Distance  = source.Distance.ToString("N0");
            return(destin);
        }
Пример #2
0
        public static DomainModel.BusStop ConvertToDomain(this BusStop source, double?lat, double?lon)
        {
            var distance = -1.0d;

            if (lat.HasValue && lon.HasValue)
            {
                var origin = new GeoCoordinate(lat.Value, lon.Value);
                var destin = new GeoCoordinate(source.Latitude, source.Longitude);
                distance = origin.GetDistanceTo(destin);
            }
            var domain = new DomainModel.BusStop(source.Id, source.Title, source.Latitude, source.Longitude, source.Tag, distance);

            return(domain);
        }