private void UpdateAvailableCopies()
        {
            magazineId = GetMagazineId();
            magazine   = MagazineAvailable.FirstOrDefault(p => p.IdMagazine == magazineId);

            if (magazine != null)
            {
                var copieDisponibili = magazine.NumeroCopieTotale - magazine.NumeroCopieVendute - magazine.NumeroCopieRese;
                magazineSold = MagazineSoldList.FirstOrDefault(p => p.IdMagazine == magazineId);
                if (magazineSold != null)
                {
                    copieDisponibili -= magazineSold.CopieVendute;
                }
                var rangeCopie = Enumerable.Range(0, copieDisponibili + 1);
                cbNumeroCopie.ItemsSource   = rangeCopie;
                cbNumeroCopie.SelectedIndex = 0;
            }
        }
 private void ImportMagazineSelectedIntoSold(MagazineModel magazineSelected)
 {
     magazineSold = MagazineSoldList.FirstOrDefault(p => p.IdMagazine == magazineSelected.IdMagazine);
     if (magazineSold == null)
     {
         magazineSold = new MagazineSoldOverview
         {
             IdMagazine       = magazineSelected.IdMagazine,
             Nome             = magazineSelected.Nome,
             Numero           = (int)magazineSelected.Numero,
             CopieVendute     = 0,
             CopieDisponibili = magazineSelected.NumeroCopieTotale - magazineSelected.NumeroCopieRese - magazineSelected.NumeroCopieVendute,
             Prezzo           = magazineSelected.Prezzo,
             ISSN             = magazineSelected.ISSN
         };
         MagazineSoldList.Add(magazineSold);
     }
 }