Esempio n. 1
0
        public ActionResult Edit([Bind(Include = "id,tenphieu,idloaiphieu,iddoandulich,ngaytao")] phieuthanhtoan phieuthanhtoan,
                                 [Bind(Prefix = "ct")] chitietthanhtoan[] chitietthanhtoan)
        {
            if (ModelState.IsValid)
            {
                pttbus.update(phieuthanhtoan, chitietthanhtoan);
                return(RedirectToAction("Index"));
            }
            ViewBag.iddoandulich = new SelectList(pttbus.db1.GetAll(), "id", "tendoan", phieuthanhtoan.iddoandulich);
            ViewBag.idloaiphieu  = new SelectList(pttbus.db2.GetAll(), "id", "tenloaiphieu", phieuthanhtoan.idloaiphieu);
            phieuthanhtoanviewmodel pttvm = new phieuthanhtoanviewmodel();

            pttvm.phieuthanhtoan = phieuthanhtoan;
            return(View(pttvm));
        }
Esempio n. 2
0
        // GET: phieuthanhtoans/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            phieuthanhtoan phieuthanhtoan = pttbus.db.First(c => c.id == id);

            if (phieuthanhtoan == null)
            {
                return(HttpNotFound());
            }
            ViewBag.iddoandulich = new SelectList(pttbus.db1.GetAll(), "id", "tendoan", phieuthanhtoan.iddoandulich);
            ViewBag.idloaiphieu  = new SelectList(pttbus.db2.GetAll(), "id", "tenloaiphieu", phieuthanhtoan.idloaiphieu);
            phieuthanhtoanviewmodel pttvm = new phieuthanhtoanviewmodel();

            pttvm.phieuthanhtoan = phieuthanhtoan;
            return(View(pttvm));
        }