コード例 #1
0
        public async Task <ActionResult> Delete(DeleteVehicleRequestModel requestModel)
        {
            // There should be the One but we could anticipate more downstream from here.
            var vehicles = (await VehicleManager.GetAllAsync <Vehicle>(
                                x => x.Id == requestModel.VehicleId)).ToArray();

            if (vehicles.Any())
            {
                VehicleManager.DeleteAsync(vehicles).Wait();
            }

            return(RedirectToAction("Index"));
        }
コード例 #2
0
        public async Task <ActionResult> Index()
        {
            var viewModels = (await VehicleManager.GetAllAsync <Vehicle>())
                             .Select(Mapper.Map <Vehicle, VehicleViewModel>)
                             .Select(InformClosestModelYearColor)
                             .OrderBy(x => x.ManufacturerName)
                             .ThenBy(x => x.ModelName)
                             .ThenByDescending(x => x.Year)
                             .ThenBy(x => x.ColorName)
                             .ThenBy(x => x.Mileage)
            ;

            return(View(viewModels));
        }