public void Update(Dvd updatedDvd) { using (SqlConnection conn = new SqlConnection()) { conn.ConnectionString = _connection; SqlCommand cmd = new SqlCommand(); cmd.Connection = conn; cmd.CommandText = "DvdUpdate"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@DvdId", updatedDvd.DvdId); cmd.Parameters.AddWithValue("@Title", updatedDvd.Title); cmd.Parameters.AddWithValue("@Year", updatedDvd.ReleaseDate); cmd.Parameters.AddWithValue("@Director", updatedDvd.Director); cmd.Parameters.AddWithValue("@Rating", updatedDvd.Rating); cmd.Parameters.AddWithValue("@Notes", updatedDvd.Notes); conn.Open(); cmd.ExecuteNonQuery(); } }
public void Create(Dvd newDvd) { _dvd.Add(newDvd); }
public void Update(Dvd updatedDvd) { _dvd.RemoveAll(d => d.DvdId == updatedDvd.DvdId); _dvd.Add(updatedDvd); }
public void Create(Dvd newDvd) { _data.Dvds.Add(newDvd); _data.SaveChanges(); }