private void btAdd_Click(object sender, RoutedEventArgs e)
 {
     modal = new AddCreditNoteLineItemModal();
     AddCreditNoteLineViewModel vmLineItem = modal.DataContext as AddCreditNoteLineViewModel;
     vmLineItem.Setup(vm.InvoiceId);
     modal.Closed += (s, modale) =>
     {
         if (modal.DialogResult == true)
         {
             vm.AddLineItem(vmLineItem);
         }
     };
     modal.ShowDialog();
 }
 private void hlEdit_Click(object sender, RoutedEventArgs e)
 {
     Hyperlink hl = sender as Hyperlink;
     string tag = hl.Tag.ToString();
     Guid ParentProductid = Guid.Parse(hl.Tag.ToString()); //int.Parse(tag[0].ToString());
     var load = vm.LoadForEdit(ParentProductid);
     modal = new AddCreditNoteLineItemModal();
    
     AddCreditNoteLineViewModel vmLineItem = modal.DataContext as AddCreditNoteLineViewModel;
     vmLineItem.Setup(vm.InvoiceId);
     vmLineItem.Reason = load.Reason;
     vmLineItem.QuantityRequired = load.Quantity;
     vmLineItem.ProductLookUp = vmLineItem.ProductLookUpList.FirstOrDefault(p => p.ProductId == load.ProductId);
     modal.Closed += (s, modale) =>
     {
         if (modal.DialogResult == true)
         {
             vm.AddLineItem(vmLineItem);
         }
     };
     modal.ShowDialog();
 }