Ejemplo n.º 1
0
 public static void Add(CarColor c)
 {
     using (SqlConnection con = new SqlConnection(connectionString))
     {
         con.Open();
         using (SqlCommand command = new SqlCommand("INSERT INTO colors (name) VALUES(@name)", con))
         {
             command.Parameters.AddWithValue("@name", c.Name);
             command.ExecuteNonQuery();
         }
     }
 }
Ejemplo n.º 2
0
        public static void Update(CarColor c)
        {
            using (SqlConnection con = new SqlConnection(connectionString))
            {
                con.Open();
                using (SqlCommand command = new SqlCommand("UPDATE colors SET name = @name WHERE id = @id", con))
                {
                    command.Parameters.AddWithValue("@id", c.Id);
                    command.Parameters.AddWithValue("@name", c.Name);

                    command.ExecuteNonQuery();
                }
            }
        }
Ejemplo n.º 3
0
 public Car(int id, string registrationNumber,
            Model model, int year, string engineNumber,
            string frameNumber, CarColor color, string engineVolume,
            string description, string carOwnerName, string contactNumber)
 {
     this.Id = id;
     this.RegistrationNumber = registrationNumber;
     this.Model         = model;
     this.Year          = year;
     this.EngineNumber  = engineNumber;
     this.FrameNumber   = frameNumber;
     this.Description   = description;
     this.Color         = color;
     this.EngineVolume  = engineVolume;
     this.Description   = description;
     this.CarOwnerName  = carOwnerName;
     this.ContactNumber = contactNumber;
 }