public CarModel UpdateCar(CarModel carModel)
        {
            DataTable dt          = new DataTable();
            CarModel  carModelSql = new CarModel();

            using (MySqlCommand command = new MySqlCommand())
            {
                dt = GetMultipleQuery(CarStringsMySql.UpdateCar(carModel));
            }
            foreach (DataRow ms in dt.Rows)
            {
                carModelSql = CarModel.ToObject(ms);
            }

            return(carModelSql);
        }
        public List <CarModel> GetAllCars()
        {
            DataTable       dt      = new DataTable();
            List <CarModel> arrCars = new List <CarModel>();

            using (MySqlCommand command = new MySqlCommand())
            {
                dt = GetMultipleQuery(CarStringsMySql.GetAllCars());
            }

            foreach (DataRow ms in dt.Rows)
            {
                CarModel carModel = CarModel.ToObject(ms);

                arrCars.Add(carModel);
            }

            return(arrCars);
        }
        public CarModel GetOneCar(string carNumber)
        {
            if (carNumber.Equals(""))
            {
                throw new ArgumentOutOfRangeException();
            }
            DataTable dt          = new DataTable();
            CarModel  carModelSql = new CarModel();

            using (MySqlCommand command = new MySqlCommand())
            {
                dt = GetMultipleQuery(CarStringsMySql.GetOneCarByNumber(carNumber));
            }

            foreach (DataRow ms in dt.Rows)
            {
                carModelSql = CarModel.ToObject(ms);
            }

            return(carModelSql);
        }
        public CarModel UploadCarImage(string carNumber, string img)
        {
            DataTable dt          = new DataTable();
            CarModel  carModel    = GetOneCar(carNumber);
            CarModel  carModelSql = new CarModel();

            if (carModel == null)
            {
                return(carModel);
            }
            carModel.carPicture = img;

            using (MySqlCommand command = new MySqlCommand())
            {
                dt = GetMultipleQuery(CarStringsMySql.UpdateCar(carModel));
            }
            foreach (DataRow ms in dt.Rows)
            {
                carModelSql = CarModel.ToObject(ms);
            }

            return(carModelSql);
        }