コード例 #1
0
 // GET api/<controller>
 public IEnumerable <Vehicle> Get()
 {
     using (var manager = new VehicleManager())
     {
         return(manager.GetAll().ToList());
     }
 }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: AdminController.cs プロジェクト: gok2689/RentaCar
 public ActionResult GetVehicle()
 {
     return(View(_VehcileManager.GetAll().ToList()));
 }
コード例 #4
0
 // GET: Vehicles
 public ActionResult Index()
 {
     return(View(_vehicleManager.GetAll()));
 }