// GET: Employee/Details/5 public async Task <ActionResult> Details(int id) { var customer = context.Customers.Where(c => c.Id == id).Single(); GeocoderViewModel code = new GeocoderViewModel(); string address = code.FormatAddress(customer); var latLng = await GetLongLatFromApi(address); code.customer = customer; code.lat = latLng[0]; code.lng = latLng[1]; code.address = address; return(View(code)); }
public async Task <ActionResult> Pickups() { string userId = User.Identity.GetUserId(); var employee = context.Employees.Where(e => e.ApplicationId == userId).Single(); var employeeZip = employee.zipCode; var customersInZip = context.Customers.Where(c => c.zip == employeeZip).ToList(); ResetPastPickups(customersInZip); DateTime thisDay = DateTime.Today; DayOfWeek today = thisDay.DayOfWeek; var todaysCustomers = customersInZip.Where(c => c.pickupDay == today || c.oneTimePickup == thisDay).ToList(); var todaysAvailableCustomers = todaysCustomers.Where(c => (thisDay < c.startBreak || c.startBreak == null) || (thisDay > c.endBreak || c.endBreak == null)).ToList(); var todayRemaining = todaysAvailableCustomers.Where(c => c.confirmed == false).ToList(); // make viewbag to get latLongs for wholeLsit // send viewbags to view and loop through List <GeocoderViewModel> codeViewList = new List <GeocoderViewModel>(); foreach (Customer cust in todayRemaining) { GeocoderViewModel code = new GeocoderViewModel(); string address = code.FormatAddress(cust); var latLng = await GetLongLatFromApi(address); code.customer = cust; code.lat = latLng[0]; code.lng = latLng[1]; code.address = address; codeViewList.Add(code); } return(View(codeViewList)); }