public PetsRepository(MemoryCacheHelper memoryCache)
        {
            _cache = memoryCache;

            if (_cache.CacheTryGetValue(PetMemoryKey) == null)
            {
                var items = new List <Pet>()
                {
                    new Pet {
                        Id = 1, Name = "Tom", Dob = new DateTime(2015, 1, 1), Sex = "Male", Breed = "German Shepard"
                    },
                    new Pet {
                        Id = 2, Name = "Jerry", Dob = new DateTime(2015, 1, 1), Sex = "Male", Breed = "Bulldog"
                    },
                    new Pet {
                        Id = 3, Name = "Max", Dob = new DateTime(2015, 1, 1), Sex = "Male", Breed = "Labrador Etriever"
                    },
                    new Pet {
                        Id = 4, Name = "Amber", Dob = new DateTime(2015, 1, 1), Sex = "Female", Breed = "Poodle"
                    },
                    new Pet {
                        Id = 5, Name = "Abbey", Dob = new DateTime(2015, 1, 1), Sex = "Female", Breed = "Boxer"
                    },
                };

                _cache.CacheTrySetValue(PetMemoryKey, items);
            }
        }
        public CarsRepository(MemoryCacheHelper memoryCache)
        {
            _cache = memoryCache;

            if (_cache.CacheTryGetValue(CarMemoryKey) == null)
            {
                var items = new List <Car>()
                {
                    new Car {
                        Id = 1, Make = "Audi", Model = "Q3", Year = "2018", CurrentMileage = 8522
                    },
                    new Car {
                        Id = 2, Make = "Mercedes", Model = "C500", Year = "2018", CurrentMileage = 8324
                    },
                    new Car {
                        Id = 3, Make = "Honda", Model = "CRV", Year = "2018", CurrentMileage = 9000
                    },
                    new Car {
                        Id = 4, Make = "Honda", Model = "Accord", Year = "2018", CurrentMileage = 20000
                    },
                    new Car {
                        Id = 5, Make = "Audi", Model = "Q3", Year = "2018", CurrentMileage = 5000
                    }
                };

                _cache.CacheTrySetValue(CarMemoryKey, items);
            }
        }
        /// <summary>
        /// Gets all pets async.
        /// </summary>
        /// <returns>The all pets async.</returns>
        /// <param name="page">Page.</param>
        /// <param name="perPage">Per page.</param>
        public async Task <PagedList <Pet> > GetAllPetsAsync(int page, int perPage)
        {
            var items = await Task.FromResult(_cache.CacheTryGetValue(PetMemoryKey) as List <Pet>);

            return(PagedList <Pet> .Create(items.AsQueryable(), page, perPage));
        }