public ActionResult DeleteConfirmed(int id)
        {
            Invoice invoice = _unitOfWork.Invoices.Get((int)id);

            _unitOfWork.Invoices.Remove(invoice);
            _unitOfWork.Complete();

            return(RedirectToAction("Index"));
        }
        public ActionResult Edit([Bind(Include = "Id,DateTime,Content")] Invoice invoice)
        {
            if (ModelState.IsValid)
            {
                //db.Entry(invoice).State = EntityState.Modified;
                _unitOfWork.Invoices.Update(invoice);
                int entityId = _unitOfWork.Complete();

                return(RedirectToAction("Index"));
                //return Redirect("edit/" + entityId);
            }
            return(View(invoice));
        }
        // GET: Invoices/Delete/5
        public ActionResult Delete(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }

            Invoice invoice = _unitOfWork.Invoices.Get((int)id);

            if (invoice == null)
            {
                return(HttpNotFound());
            }
            return(View(invoice));
        }
        public ActionResult Create([Bind(Include = "Id,DateTime,Content")] Invoice invoice)
        {
            if (ModelState.IsValid)
            {
                var stockItem = new StockItem();
                stockItem = _unitOfWork.StockItems.Get(1);

                var stockItemList = new List <StockItem>();
                stockItemList.Add(stockItem);

                invoice.StockItems = stockItemList;

                _unitOfWork.Invoices.Add(invoice);

                int entityId = _unitOfWork.Complete();
                return(Content(entityId.ToString()));
            }

            return(View(invoice));
        }