// GET: Colors/Details/5 public async Task <IActionResult> Details(int?id) { if (id == null) { return(NotFound()); } var color = await _colorRepository .GetByIdAsync(id.Value); if (color == null) { return(NotFound()); } return(View(color)); }
public async Task <DeleteVehicleViewModel> ToDeleteVehicleViewModelAsync(Vehicle vehicle) { var brand = await _brandRepository.GetByIdAsync(vehicle.BrandId); var modelType = await _brandRepository.GetModelByIdAsync(vehicle.ModelId); var fuel = await _fuelRepository.GetByIdAsync(vehicle.FuelId); var color = await _colorRepository.GetByIdAsync(vehicle.ColorId); var model = new DeleteVehicleViewModel { Id = vehicle.Id, LicencePlate = vehicle.LicencePlate, Brand = brand.BrandName, ModelName = modelType.ModelName, EngineCapacity = vehicle.EngineCapacity, FuelType = fuel.FuelType, ColorName = color.ColorName, }; return(model); }