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")); }
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)); }