public ActionResult DeleteConfirmed(int id)
        {
            agent_payment_detail agent_payment_detail = db.agent_payment_detail.Find(id);

            db.agent_payment_detail.Remove(agent_payment_detail);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "id,id_payment,id_book,quantity")] agent_payment_detail agent_payment_detail)
 {
     if (ModelState.IsValid)
     {
         db.Entry(agent_payment_detail).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     ViewBag.id_payment = new SelectList(db.agent_payment, "id", "id", agent_payment_detail.id_payment);
     ViewBag.id_book    = new SelectList(db.books, "id", "name", agent_payment_detail.id_book);
     return(View(agent_payment_detail));
 }
        public ActionResult Create([Bind(Include = "id,id_payment,id_book,quantity")] agent_payment_detail agent_payment_detail)
        {
            if (ModelState.IsValid)
            {
                db.agent_payment_detail.Add(agent_payment_detail);
                db.SaveChanges();
                return(Json(new { con = "success" }));
            }

            ViewBag.id_payment = new SelectList(db.agent_payment, "id", "id", agent_payment_detail.id_payment);
            ViewBag.id_book    = new SelectList(db.books, "id", "name", agent_payment_detail.id_book);
            return(Json(new { con = "error" }));
        }
        // GET: agent_payment_detail/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            agent_payment_detail agent_payment_detail = db.agent_payment_detail.Find(id);

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

            if (agent_payment_detail == null)
            {
                return(HttpNotFound());
            }
            ViewBag.id_payment = new SelectList(db.agent_payment, "id", "id", agent_payment_detail.id_payment);
            ViewBag.id_book    = new SelectList(db.books, "id", "name", agent_payment_detail.id_book);
            return(View(agent_payment_detail));
        }