//
        // GET: /Invoice/Create
        public ActionResult Create()
        {
            Initialize();
            var invoice = new Invoice
                              {Employee = _user.DisplayName, EmployeePUID = _employeepuid, CompanyDomain = _domain};

            return View(invoice);
        }
 public ActionResult Edit(Invoice invoice)
 {
     if (ModelState.IsValid)
     {
         _db.Entry(invoice).State = EntityState.Modified;
         _db.SaveChanges();
         return RedirectToAction("Index");
     }
     return View(invoice);
 }
        public ActionResult Edit(Invoice invoice)
        {
            Initialize();

            if (ModelState.IsValid)
            {
                invoice.EmployeePUID = _employeepuid;
                invoice.CompanyDomain = _domain;
                _db.Entry(invoice).State = EntityState.Modified;
                _db.SaveChanges();
                return RedirectToAction("Index");
            }

            return View(invoice);
        }
        public ActionResult Create(Invoice invoice)
        {
            Initialize();

            if (ModelState.IsValid)
            {
                invoice.EmployeePUID = _employeepuid;
                invoice.CompanyDomain = _domain;
                invoice.InvoiceStatus = 0;

                _db.Invoices.Add(invoice);
                _db.SaveChanges();

                return RedirectToAction("Details", new {id = invoice.InvoiceID});

            }
            return View(invoice);

        }