Пример #1
0
        public ActionResult ChangeCar(string carId, string Url, string Brand, string Model, string YearOfProduction, string km, string TransmissionType, string TopSpeed, string Acceleration, string UrbanConsumption, string Fuel, string WheelDrive)
        {
            bool result = false;

            if (Url != "")
            {
                result = CarManager.ChangeCar(Url.Replace("'", "'"), carId, 1);
            }
            if (Brand != "")
            {
                result = CarManager.ChangeCar(Brand.Replace("'", "'"), carId, 2);
            }
            if (Model != "")
            {
                result = CarManager.ChangeCar(Model.Replace("'", "'"), carId, 3);
            }
            if (YearOfProduction != "")
            {
                result = CarManager.ChangeCar(YearOfProduction.Replace("'", "'"), carId, 4);
            }
            if (km != "")
            {
                result = CarManager.ChangeCar(km, carId, 5);
            }
            if (TransmissionType != "")
            {
                result = CarManager.ChangeCar(TransmissionType, carId, 6);
            }
            if (Fuel != "")
            {
                result = CarManager.ChangeCar(Fuel, carId, 7);
            }
            if (TopSpeed != "")
            {
                result = CarManager.ChangeCar(TopSpeed, carId, 8);
            }
            if (Acceleration != "")
            {
                result = CarManager.ChangeCar(Acceleration, carId, 9);
            }
            if (UrbanConsumption != "")
            {
                result = CarManager.ChangeCar(UrbanConsumption, carId, 10);
            }
            if (WheelDrive != "")
            {
                result = CarManager.ChangeCar(WheelDrive, carId, 11);
            }
            if (result)
            {
                ViewBag.message = "Car successfully updated.";
            }
            else
            {
                ViewBag.message = "Car couldn't be updated. Try again.";
            }

            return(View(CarManager.GetUserCars(Session["UserId"].ToString())));
        }