Example #1
0
 // GET: VehicleTypes
 public ActionResult Index(string searchText)
 {
     if (searchText != null)
     {
         ICollection <VehicleType>          vehicleType           = _vehicleTypeManager.SearchByText(searchText);
         IEnumerable <VehicleTypeViewModel> vehicleTypeViewModels =
             Mapper.Map <IEnumerable <VehicleTypeViewModel> >(vehicleType);
         return(View(vehicleTypeViewModels));
     }
     else
     {
         ICollection <VehicleType>          vehicleType           = _vehicleTypeManager.GetAll();
         IEnumerable <VehicleTypeViewModel> vehicleTypeViewModels =
             Mapper.Map <IEnumerable <VehicleTypeViewModel> >(vehicleType);
         return(View(vehicleTypeViewModels));
     }
 }
Example #2
0
 // GET: VehicleTypes
 public ActionResult Index(string searchText)
 {
     try
     {
         if (searchText != null)
         {
             ICollection <VehicleType>          vehicleType           = _vehicleTypeManager.SearchByText(searchText);
             IEnumerable <VehicleTypeViewModel> vehicleTypeViewModels =
                 Mapper.Map <IEnumerable <VehicleTypeViewModel> >(vehicleType);
             return(View(vehicleTypeViewModels));
         }
         else
         {
             ICollection <VehicleType>          vehicleType           = _vehicleTypeManager.GetAll();
             IEnumerable <VehicleTypeViewModel> vehicleTypeViewModels =
                 Mapper.Map <IEnumerable <VehicleTypeViewModel> >(vehicleType);
             return(View(vehicleTypeViewModels));
         }
     }
     catch (Exception ex)
     {
         return(View("Error", new HandleErrorInfo(ex, "VehicleTypes", "Index")));
     }
 }