public ActionResult Create([Bind(Include = "SupplierInvoiceId,SupplierId,InvoiceDate,SubTotal,TaxAmount,Total,AmountPaid,Approved,Active")] SupplierInvoice supplierInvoice)
 {
     if (ModelState.IsValid)
     {
         if (invMgr.CreateSupplierInvoice(supplierInvoice) != 0)
         {
             return(RedirectToAction("Index"));
         }
     }
     return(View(supplierInvoice));
 }
 /// <summary>
 /// Christian Lopez
 /// 2017/03/29
 ///
 /// Creates the supplier invoice and the invoice lines
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void btnSubmit_Click(object sender, RoutedEventArgs e)
 {
     if (_invoiceLines.Count > 0)
     {
         SupplierInvoice invoice = new SupplierInvoice()
         {
             SupplierId  = _supplier.SupplierID,
             InvoiceDate = DateTime.Now,
             SubTotal    = invoiceSubtotalCost,
             TaxAmount   = invoiceTax,
             Total       = invoiceTotalCost,
             AmountPaid  = 0
         };
         int invoiceID;
         try
         {
             invoiceID = _supplierInvoiceManager.CreateSupplierInvoice(invoice);
             foreach (SupplierInvoiceLine item in _invoiceLines)
             {
                 item.SupplierInvoiceId = invoiceID;
                 if (!_supplierInvoiceManager.CreateSupplierInvoiceLine(item))
                 {
                     MessageBox.Show("Error adding invoice");
                     break;
                 }
             }
             this.DialogResult = true;
         }
         catch (Exception ex)
         {
             if (null != ex.InnerException)
             {
                 MessageBox.Show(ex.Message + "\n\n" + ex.InnerException.Message);
             }
             else
             {
                 MessageBox.Show(ex.Message);
             }
         }
     }
     else
     {
         MessageBox.Show("Please add invoice items to submit.");
     }
 }