// GET: Invoices/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null || id == 0)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            vwInvoice vwInvoice = db.vwInvoices.Where(vwi => vwi.Invoice_Number == id).SingleOrDefault();

            if (vwInvoice == null)
            {
                return(HttpNotFound());
            }
            ViewBag.LineItems = db.LineItems.Where(li => li.InvoiceId == id).ToList();
            return(View(vwInvoice));
        }
        public ActionResult Index(int?invoiceId)
        {
            vwInvoice invoice = null;

            if (invoiceId != null)
            {
                invoice = db.vwInvoices.Where(v => v.Invoice_Number == invoiceId).SingleOrDefault();
                if (invoice != null)
                {
                    return(View(db.vwInvoices.Where(v => v.Invoice_Number == invoiceId).ToList()));
                }
                else
                {
                    return(View(db.vwInvoices.ToList()));
                }
            }
            else
            {
                return(View(db.vwInvoices.ToList()));
            }
        }