Esempio n. 1
0
 private int DeleteVideo()
 {
     try
     {
         string errMsg = String.Empty;
         if (cboVideosVideo.SelectedIndex < 0)
         {
             errMsg = "No video selected" + Environment.NewLine;
         }
         if (cboVideosVideo.SelectedIndex < 0)
         {
             MessageBox.Show(errMsg);
             return(-1);
         }
         var video = new Video()
         {
             Id   = ((ComboClass)cboVideosVideo.SelectedItem).Id,
             Name = ((ComboClass)cboVideosVideo.SelectedItem).Name
         };
         booking.DeleteVideo(video);
         FillVideos();
         FillAvailbaleVideos();
         FillBookedVideos();
         return(cboVideosVideo.Items.Count - 1);
     }
     catch (VideoRentalException ex)
     {
         MessageBox.Show(ex.Message);
         return(Int32.MinValue);
     }
     catch
     {
         return(-1);
     }
 }