Esempio n. 1
0
        public async Task <IActionResult> Edit(long id, string returnUrl)
        {
            var car = await _carsDao.GetByIdAsync(id);

            return(View(
                       new EditViewModel
            {
                Id = car.Id,
                EditorMode = EditorMode.Update,
                Model = car.Model,
                Number = car.Number,
                ReturnUrl = returnUrl
            }));
        }
Esempio n. 2
0
        private async Task <bool> CacheCarAsync(long carId = default(long))
        {
            if (carId == default(long))
            {
                var session = _httpContextAccessor.HttpContext.Session;
                carId = session.GetJson <long>(CarIdJsonKey);
                if (carId == default(long))
                {
                    return(false);
                }
            }

            _cachedCar = await _carsDao.GetByIdAsync(carId);

            return(_cachedCar != null);
        }