public ActionResult DisplayCustomerDetails(int id)
        {
            GoogleAPIKey   keyClass        = new GoogleAPIKey();
            string         myKey           = keyClass.Key;
            string         identityUserId  = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
            int            employeeZipCode = _context.Employees.FirstOrDefault(e => e.IdentityUser_Id == identityUserId).ZipCode;
            List <Address> addresses       = _context.Addresses.Where(a => a.Customer_Id == id && a.Zip_Code == employeeZipCode).Include(a => a.Customer).ToList();

            addresses[0].APIKey = "https://maps.googleapis.com/maps/api/js?key=" + myKey + "&callback=initMap";
            return(View(addresses));
        }
        private async Task <string> GeocodeAddress(Address address)
        {
            using (HttpClient client = new HttpClient())
            {
                string apiKey = new GoogleAPIKey().Key;
                HttpResponseMessage response = await client.GetAsync("https://maps.googleapis.com/maps/api/geocode/json?address=" + GetURLVerionOfAddress(address) + "&key=" + apiKey);

                var data = await response.Content.ReadAsStringAsync();

                JObject dataAsJObject = JsonConvert.DeserializeObject <JObject>(data);
                string  lat           = dataAsJObject["results"][0]["geometry"]["location"]["lat"].ToString();
                string  lng           = dataAsJObject["results"][0]["geometry"]["location"]["lng"].ToString();
                return(lat + " " + lng);
            }
        }
        public ActionResult Index(int todayId = 0)
        {
            string   currentUserId = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
            Employee employee      = _context.Employees.FirstOrDefault(e => e.IdentityUser_Id == currentUserId);
            string   myKey         = new GoogleAPIKey().Key;

            ViewBag.Key   = "https://maps.googleapis.com/maps/api/js?key=" + myKey + "&callback=initMap";
            employee.Days = _context.Days.ToList();
            DateTime today = DateTime.Now;

            SetAllPickupsThatAreNotForTodayToNotPickedUp(today);
            employee.Pickups = new List <Pickup>();
            GetPickups(employee, today);
            employee.Pickups = employee.Pickups.Where(p => p.PickedUp == null).OrderBy(p => p.Day_Id).ToList();
            if (todayId == 0)
            {
                employee.Pickups = employee.Pickups.Where(p => p.Day.Name == today.DayOfWeek.ToString()).ToList();
            }
            else if (todayId != 8)
            {
                employee.Pickups = employee.Pickups.Where(p => p.Day_Id == todayId).ToList();
            }
            return(View(employee));
        }