Пример #1
0
        public async Task setLocation(Client myobj)
        {
            using (var db = new DALContext())
            {
                (double lat, double lng) = (myobj.location.Latitude, myobj.location.Longitude);

                string addressClient = myobj.address.street + " " + myobj.address.city;
                if (myobj.address.street == "default" || myobj.address.city == "default")
                {
                    throw new Exception("the address is not a valid address");
                }
                (lat, lng) = await LocationHelper.GetLatLong(addressClient);



                myobj.location = new Microsoft.Maps.MapControl.WPF.Location(lat, lng);
                await db.SaveChangesAsync();
            }
        }