示例#1
0
        public ActionResult OnAddCar(int trackId, bool hasTowStrap, int tireWear)
        {
            if (hasTowStrap && tireWear < 85)
            {
                trackService.AddCar(new Car
                {
                    HasTowStrap        = hasTowStrap,
                    TireWearPercentage = tireWear,
                    TrackId            = trackId
                });

                return(Json(new { ReturnStatus = "success" }, JsonRequestBehavior.AllowGet));
            }
            return(Json(new { ReturnStatus = "error", ReturnData = "Car did not pass the inspection!" },
                        JsonRequestBehavior.AllowGet));
        }