public ActionResult EnterNewCar(CarViewModel tempModel)
 {
     CarModel carModel = new CarModel(tempModel);
     int CarId=1;
     CarDAO.InsertCar(carModel);
     CarPhotoViewModel carPhotoViewModel = new CarPhotoViewModel();
     carPhotoViewModel.Id = CarId;
     return RedirectToAction("UploadPhoto", new { carPhotoViewModel });
 }
        public static void InsertCar(CarModel model)
        {
            SqlConnection conn = new SqlConnection(sqlconn);
            conn.Open();

            try
            {
                String num = "Select (max(id))+1 from Car";

                int x = Int32.Parse(num);

                string query = "Insert into Car(id,make,variant,type,engine_type,color,price,mileage,capacity,numofowners,condition_car,status,transmission,fuel,additionalinfo) values ('" + x + "','" + model.Make + "','" + model.Variant + "','" + model.Type + "','" + model.EngineType + "','" + model.Color + "','" + model.Price + "','" + model.Mileage + "','" + model.Capacity + "','" + model.NumberOfOwners + "','" + model.Condition + "','" + model.Status + "','" + model.Transmission + "','" + model.Fuel + "','" + model.AdditionalInfo + "')";

                cmd = new SqlCommand(query, conn);
                cmd.ExecuteReader();
                conn.Close();
            }

            catch (Exception e)
            {

            }
        }