// GET api/<controller>
 public IEnumerable <Vehicle> Get()
 {
     using (var manager = new VehicleManager())
     {
         return(manager.GetAll().ToList());
     }
 }
        private VehicleViewModel InformClosestModelYearColor(VehicleViewModel viewModel)
        {
            var choices = VehicleManager.GetAll <ModelYearColor>(
                x => x.ModelYear.Model.Id == viewModel.ModelId &&
                x.ModelYear.Model.Make.Id == viewModel.ManufacturerId)
                          .ToArray();

            /* Follow the punctionation here. We're either getting the choice, or the first (or
             * default), and Id, if it is available, or the Empty value when all else fails. If
             * we've gotten this far, that should be a rare, if ever, corner case. */

            var choice = choices.FirstOrDefault(x => x.Color.Id == viewModel.ColorId);

            viewModel.ModelYearColorId = (choice ?? choices.FirstOrDefault())?.Id ?? Guid.Empty;

            return(viewModel);
        }
Beispiel #3
0
 public ActionResult GetVehicle()
 {
     return(View(_VehcileManager.GetAll().ToList()));
 }
Beispiel #4
0
 // GET: Vehicles
 public ActionResult Index()
 {
     return(View(_vehicleManager.GetAll()));
 }