public ActionResult AvailabilityReport(string searchString, /*string hiddenDateRange,*/ int? specialtySearch, string active, bool all = false, bool mon = false, bool tue = false, bool wed = false, bool thu = false, bool fri = false, bool sat = false)
        {
            ViewBag.viewName = "index";
            ViewBag.FullName = getUserName();

            List<AvailabilityReportVol> AvailabilityReportFullList = new List<AvailabilityReportVol> { };
            List<AvailabilityReportVol> AvailabilityReportFilteredList = new List<AvailabilityReportVol> { };
            AvailabilityReportVol vol = new AvailabilityReportVol();

            var volunteers = db.Volunteers.ToList();
            var availabilities = db.Availabilities.ToList();

            var sorts = (from v in volunteers
                        join a in availabilities on v.volID equals a.volID
                        where v.volID == a.volID 
                        select v).Distinct();

            List<string> daysQuery = new List<string>();
            if (all) { ViewBag.allChkd = "checked"; ViewBag.allActv = "active"; }
            if (mon) { daysQuery.Add("Monday"); ViewBag.MonChkd = "checked"; ViewBag.MonActv = "active"; ViewBag.Mon = true; }
            if (tue) { daysQuery.Add("Tuesday"); ViewBag.TueChkd = "checked"; ViewBag.TueActv = "active"; ViewBag.Tue = true; }
            if (wed) { daysQuery.Add("Wednesday"); ViewBag.WedChkd = "checked"; ViewBag.WedActv = "active"; ViewBag.Wed = true; }
            if (thu) { daysQuery.Add("Thursday"); ViewBag.ThuChkd = "checked"; ViewBag.ThuActv = "active"; ViewBag.Thu = true; }
            if (fri) { daysQuery.Add("Friday"); ViewBag.FriChkd = "checked"; ViewBag.FriActv = "active"; ViewBag.Fri = true; }
            if (sat) { daysQuery.Add("Saturday"); ViewBag.SatChkd = "checked"; ViewBag.SatActv = "active"; ViewBag.Sat = true; }

            var specialties = db.Specialties.OrderBy(q => q.spcName).ToList();
            ViewBag.specialtySearch = new SelectList(specialties, "spcID", "spcName", specialtySearch);
            int specialtyID = specialtySearch.GetValueOrDefault();

            if (!String.IsNullOrEmpty(searchString))
            {
                sorts = sorts.Where(s => s.volLastName.Contains(searchString)
                                       || s.volFirstName.Contains(searchString));
            }

            if (specialtySearch.HasValue)
            {
                sorts = sorts.Where(s => s.spcID == specialtyID);
            }

            if (active != null)
            {
                switch (active)
                {
                    case "0":
                        ViewBag.falseSelected = "selected";
                        sorts = sorts.Where(s => s.volActive == false);
                        break;
                    case "1":
                        ViewBag.trueSelected = "selected";
                        sorts = sorts.Where(s => s.volActive == true);
                        break;
                    case "2":
                        ViewBag.allSelected = "selected";
                        sorts = sorts.Where(s => s.volActive == true || s.volActive == false);
                        break;
                }
            }

            //create new object for each vol in sorts including properties for hours and exposing volID; adds to list of new objects
            foreach (var item in sorts)
            {
                List<string> days = new List<string>();
                List<string> daysQueried = new List<string>();
                List<string> hours = new List<string>();
                vol = new AvailabilityReportVol();
                
                vol.id = item.volID;
                vol.volunteer = item;

                foreach (var avail in availabilities)
                {
                    if (vol.id == avail.volID)
                    {
                        if (daysQuery.Contains(avail.avDay.ToString()))
                        {
                            daysQueried.Add(avail.avDay.ToString());
                        }
                        else
                        {
                            days.Add(avail.avDay.ToString()); 
                        }
                                     
                        hours.Add(avail.avFrom.ToString("hh:mm tt") + " - " + avail.avUntil.ToString("hh:mm tt"));
                    }
                }
                vol.days = days;
                vol.daysQueried = daysQueried;
                vol.hours = hours;
                AvailabilityReportFullList.Add(vol);
            }

            foreach (var item in AvailabilityReportFullList)
            {
                foreach(var day in item.daysQueried)
                {
                    if (daysQuery.Contains(day))
                    {
                        AvailabilityReportFilteredList.Add(item);
                    }
                }
            }

            Session["ARFL"] = AvailabilityReportFilteredList;
               
            return View(AvailabilityReportFilteredList.Distinct());
        }
        public ActionResult AvailabilityReport(string searchString, /*string hiddenDateRange,*/ int?specialtySearch, string active, bool all = false, bool mon = false, bool tue = false, bool wed = false, bool thu = false, bool fri = false, bool sat = false)
        {
            ViewBag.viewName = "index";
            ViewBag.FullName = getUserName();

            List <AvailabilityReportVol> AvailabilityReportFullList     = new List <AvailabilityReportVol> {
            };
            List <AvailabilityReportVol> AvailabilityReportFilteredList = new List <AvailabilityReportVol> {
            };
            AvailabilityReportVol vol = new AvailabilityReportVol();

            var volunteers     = db.Volunteers.ToList();
            var availabilities = db.Availabilities.ToList();

            var sorts = (from v in volunteers
                         join a in availabilities on v.volID equals a.volID
                         where v.volID == a.volID
                         select v).Distinct();

            List <string> daysQuery = new List <string>();

            if (all)
            {
                ViewBag.allChkd = "checked"; ViewBag.allActv = "active";
            }
            if (mon)
            {
                daysQuery.Add("Monday"); ViewBag.MonChkd = "checked"; ViewBag.MonActv = "active"; ViewBag.Mon = true;
            }
            if (tue)
            {
                daysQuery.Add("Tuesday"); ViewBag.TueChkd = "checked"; ViewBag.TueActv = "active"; ViewBag.Tue = true;
            }
            if (wed)
            {
                daysQuery.Add("Wednesday"); ViewBag.WedChkd = "checked"; ViewBag.WedActv = "active"; ViewBag.Wed = true;
            }
            if (thu)
            {
                daysQuery.Add("Thursday"); ViewBag.ThuChkd = "checked"; ViewBag.ThuActv = "active"; ViewBag.Thu = true;
            }
            if (fri)
            {
                daysQuery.Add("Friday"); ViewBag.FriChkd = "checked"; ViewBag.FriActv = "active"; ViewBag.Fri = true;
            }
            if (sat)
            {
                daysQuery.Add("Saturday"); ViewBag.SatChkd = "checked"; ViewBag.SatActv = "active"; ViewBag.Sat = true;
            }

            var specialties = db.Specialties.OrderBy(q => q.spcName).ToList();

            ViewBag.specialtySearch = new SelectList(specialties, "spcID", "spcName", specialtySearch);
            int specialtyID = specialtySearch.GetValueOrDefault();

            if (!String.IsNullOrEmpty(searchString))
            {
                sorts = sorts.Where(s => s.volLastName.Contains(searchString) ||
                                    s.volFirstName.Contains(searchString));
            }

            if (specialtySearch.HasValue)
            {
                sorts = sorts.Where(s => s.spcID == specialtyID);
            }

            if (active != null)
            {
                switch (active)
                {
                case "0":
                    ViewBag.falseSelected = "selected";
                    sorts = sorts.Where(s => s.volActive == false);
                    break;

                case "1":
                    ViewBag.trueSelected = "selected";
                    sorts = sorts.Where(s => s.volActive == true);
                    break;

                case "2":
                    ViewBag.allSelected = "selected";
                    sorts = sorts.Where(s => s.volActive == true || s.volActive == false);
                    break;
                }
            }

            //create new object for each vol in sorts including properties for hours and exposing volID; adds to list of new objects
            foreach (var item in sorts)
            {
                List <string> days        = new List <string>();
                List <string> daysQueried = new List <string>();
                List <string> hours       = new List <string>();
                vol = new AvailabilityReportVol();

                vol.id        = item.volID;
                vol.volunteer = item;

                foreach (var avail in availabilities)
                {
                    if (vol.id == avail.volID)
                    {
                        if (daysQuery.Contains(avail.avDay.ToString()))
                        {
                            daysQueried.Add(avail.avDay.ToString());
                        }
                        else
                        {
                            days.Add(avail.avDay.ToString());
                        }

                        hours.Add(avail.avFrom.ToString("hh:mm tt") + " - " + avail.avUntil.ToString("hh:mm tt"));
                    }
                }
                vol.days        = days;
                vol.daysQueried = daysQueried;
                vol.hours       = hours;
                AvailabilityReportFullList.Add(vol);
            }

            foreach (var item in AvailabilityReportFullList)
            {
                foreach (var day in item.daysQueried)
                {
                    if (daysQuery.Contains(day))
                    {
                        AvailabilityReportFilteredList.Add(item);
                    }
                }
            }

            Session["ARFL"] = AvailabilityReportFilteredList;

            return(View(AvailabilityReportFilteredList.Distinct()));
        }