public ActionResult DeleteConfirmed(int id)
        {
            DuePayment duePayment = db.DuePayments.Find(id);

            db.DuePayments.Remove(duePayment);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "id,customerId,orderId,totalDebt,fromDate,toDate,description,status")] DuePayment duePayment)
 {
     if (ModelState.IsValid)
     {
         db.Entry(duePayment).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.customerId = new SelectList(db.Customers, "id", "email", duePayment.customerId);
     ViewBag.orderId    = new SelectList(db.Orders, "id", "address", duePayment.orderId);
     return(View(duePayment));
 }
        // GET: Admin/DuePayments/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DuePayment duePayment = db.DuePayments.Find(id);

            if (duePayment == null)
            {
                return(HttpNotFound());
            }
            return(View(duePayment));
        }
        // GET: Admin/DuePayments/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            DuePayment duePayment = db.DuePayments.Find(id);

            if (duePayment == null)
            {
                return(HttpNotFound());
            }
            ViewBag.customerId = new SelectList(db.Customers, "id", "email", duePayment.customerId);
            ViewBag.orderId    = new SelectList(db.Orders, "id", "address", duePayment.orderId);
            return(View(duePayment));
        }
        private void SaveDuePayment(PharmacyDbContext db, string invoiceId)
        {
            decimal    amount = Convert.ToDecimal(txtDuePay.Text);
            DuePayment due    = new DuePayment
            {
                Amount      = amount,
                CreatedDate = DateTime.Now,
                CreatedBy   = currentUser,
                CustomerId  = _customerId,
                Id          = Guid.NewGuid().ToString(),
                InvoiceId   = invoiceId
            };

            db.DuePayment.Add(due);
            SaveVoucher(db, invoiceId, amount);
        }