public async Task <IActionResult> FilteredPetBusinessSearch(ViewModelPetBusiness searchResults)
        {
            ViewModelPetBusiness viewModel = new ViewModelPetBusiness();

            var businesses = await _repo.PetBusiness.GetBusinessesIncludeAllAsync();

            IEnumerable <PetBusiness> petBusinesses = businesses.ToList();
            var services = await _repo.Service.GetAllServicesAsync();

            IEnumerable <Service> servicesList = services.ToList();
            var addresses = await _repo.Address.GetAllAddressesAsync();

            IEnumerable <Address> businessAddresses = addresses.ToList();
            var typesOfBusinesses = await _repo.BusinessType.GetAllBusinessTypesAsync();

            IEnumerable <BusinessType> businessTypes = typesOfBusinesses.ToList();

            if (searchResults.PetBusinessId != 0)
            {
                petBusinesses = petBusinesses.Where(b => b.Id == searchResults.PetBusinessId);
            }
            if (searchResults.BusinessTypeId != 0)
            {
                petBusinesses = petBusinesses.Where(bt => bt.BusinessTypeId == searchResults.BusinessTypeId);
            }
            //if (searchResults.ServiceId != 0)
            //{
            //    servicesList = servicesList.Where(s => s.Id == searchResults.ServiceId);
            //}
            if (searchResults.AddressId != 0)
            {
                petBusinesses = petBusinesses.Where(a => a.AddressId == searchResults.AddressId);
            }

            viewModel.PetBusinesses = petBusinesses.ToList();
            viewModel.PetBusinesses.Insert(0, (new PetBusiness()));
            viewModel.Services = _repo.Service.GetAllServices().ToList();
            viewModel.Services.Insert(0, new Service());
            viewModel.BusinessTypes = _repo.BusinessType.GetAllBusinessTypes().ToList();
            viewModel.BusinessTypes.Insert(0, new BusinessType());
            viewModel.Addresses = _repo.Address.GetAllAddresses().ToList();
            viewModel.Addresses.Insert(0, new Address());

            return(View("SearchPetBusinesses", viewModel));
        }
        //SearchPetBusinesses
        public async Task <IActionResult> SearchPetBusinesses()
        {
            ViewModelPetBusiness viewModel = new ViewModelPetBusiness();

            var businesses = await _repo.PetBusiness.GetBusinessesIncludeAllAsync();

            IEnumerable <PetBusiness> petBusinesses = businesses.ToList();

            viewModel.PetBusinesses = petBusinesses.ToList();
            viewModel.PetBusinesses.Insert(0, (new PetBusiness()));
            viewModel.Services = _repo.Service.GetAllServices().ToList();
            viewModel.Services.Insert(0, new Service());
            viewModel.BusinessTypes = _repo.BusinessType.GetAllBusinessTypes().ToList();
            viewModel.BusinessTypes.Insert(0, new BusinessType());
            viewModel.Addresses = _repo.Address.GetAllAddresses().ToList();
            viewModel.Addresses.Insert(0, new Address());

            return(View(viewModel));
        }
        public IActionResult DisplayPetBusinessDetails(int id)
        {
            var userId     = this.User.FindFirstValue(ClaimTypes.NameIdentifier);
            var petOwnerId = _repo.PetOwner.GetPetOwnerById(userId).Id;

            IEnumerable <ServiceOffered> servicesOffered = _repo.ServiceOffered.GetServicesOfferedIncludeAll(id);

            //NEED INCLUDE ALL reference in REPO
            PetBusiness petBusiness = _repo.PetBusiness.GetPetBusiness(id);
            Address     address     = _repo.Address.GetAddressById(petBusiness.AddressId);
            Follow      follow      = _repo.Follow.GetFollowByPetOwnerAndPetBusiness(id, petOwnerId);

            if (follow == null)
            {
                Follow newFollow = new Follow();
                newFollow.PetOwnerId    = petOwnerId;
                newFollow.PetBusinessId = id;
                newFollow.IsFollowing   = false;
                _repo.Follow.CreateFollow(newFollow);
                _repo.Save();

                follow = newFollow;
            }

            ViewModelPetBusiness petBusinessViewing = new ViewModelPetBusiness();

            petBusinessViewing.PetBusiness    = petBusiness;
            petBusinessViewing.PetBusinessId  = id;
            petBusinessViewing.PetOwnerId     = petOwnerId;
            petBusinessViewing.Name           = petBusiness.Name;
            petBusinessViewing.BusinessTypeId = petBusiness.BusinessTypeId;
            petBusinessViewing.Address        = address;
            petBusinessViewing.IsFollowing    = follow.IsFollowing;
            //petBusinessViewing.Address.Lat = address.Lat;
            //petBusinessViewing.Address.Lng = address.Lng;
            petBusinessViewing.ServicesOffered = servicesOffered.ToList();

            return(View(petBusinessViewing));
        }