Ejemplo n.º 1
0
        public ActionResult AddVehicleModelNumber(VehicleModelNumberModel model)
        {
            try
            {
                var vehicleService = new VehicleService(AuthenticatedUser.SessionToken);
                vehicleService.AddModelNumber(model);

                var models = vehicleService.GetModelNumbers(model.VehicleModelID);
                models.Insert(0, new VehicleModelNumberModel()
                {
                    ID = 0, Description = "Select One"
                });

                return(Json(new { IsValid = true, Data = models.Select(f => new SelectListItem {
                        Text = f.Description, Value = f.ID.ToString()
                    }).ToList() }));
            }
            catch (GatewayException gex)
            {
                return(Json(new { IsValid = false, ErrorMessage = gex.Message }));
            }
            catch (Exception ex)
            {
                return(Json(new { IsValid = false, ErrorMessage = ex.Message }));
            }
        }