コード例 #1
0
        public async Task <Automobile> GetAutomobileAsync(int theCustomerId, int id)
        {
            var aAutomobile = await _autoRepository.GetAutomobileAsync(id);

            var aLocations = await _locationRepository.GetLocationsForCustomerAsync(theCustomerId);

            // validate that customer has car on one of their locations before returning it
            // otherwise, return null
            return(aLocations.Any(aItem => aItem.Id == aAutomobile.LocationId) ? aAutomobile : null);
        }