Example #1
0
        public ActionResult GetAllVehicle()
        {
            dynamic vehicle = 0;

            try
            {
                if (ModelState.IsValid)
                {
                    VehicleServiceClient vehicleServiceClient = new VehicleServiceClient();
                    vehicle = vehicleServiceClient.GetAllVehicle();
                    //if (vehicle.Count == 0 || vehicle == null)
                    //{
                    //    ModelState.AddModelError("error", "No Record Found");
                    //}
                }
            }
            // Please through Exeption Everywhere
            catch (Exception e)
            {
                ModelState.AddModelError("error", "Something Wrong");
                vehicle = null;
                throw e;
            }
            return(Json(vehicle, JsonRequestBehavior.AllowGet));
        }