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

            db.chitietthanhtoans.Remove(chitietthanhtoan);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #2
0
 public chitietchiphi(chitietthanhtoan ct)
 {
     tenchiphi = ct.tenchiphi;
     soluong   = (int)ct.soluong;
     gia       = String.Format("{0:C}", ct.gia);
     tongs     = soluong * (decimal)ct.gia;
     tong      = String.Format("{0:C}", tongs);
     ngay      = (DateTime)ct.phieuthanhtoan.ngaytao;
 }
 public ActionResult Edit([Bind(Include = "id,idphieuthanhtoan,idchitiet,tenchiphi,soluong,gia")] chitietthanhtoan chitietthanhtoan)
 {
     if (ModelState.IsValid)
     {
         ct.sua(chitietthanhtoan);
         return(RedirectToAction("Index"));
     }
     ViewBag.idphieuthanhtoan = new SelectList(db.phieuthanhtoans, "id", "tendoan_tenphieu", chitietthanhtoan.idphieuthanhtoan);
     return(View(chitietthanhtoan));
 }
        // GET: chitietthanhtoans/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            chitietthanhtoan chitietthanhtoan = db.chitietthanhtoans.Find(id);

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

            if (chitietthanhtoan == null)
            {
                return(HttpNotFound());
            }
            ViewBag.idphieuthanhtoan = new SelectList(db.phieuthanhtoans, "id", "tendoan_tenphieu", chitietthanhtoan.idphieuthanhtoan);
            return(View(chitietthanhtoan));
        }
 public bool sua(chitietthanhtoan ct)
 {
     db.Entry(ct).State = EntityState.Modified;
     db.SaveChanges();
     return(true);
 }
 public bool them(chitietthanhtoan ct)
 {
     db.chitietthanhtoans.Add(ct);
     db.SaveChanges();
     return(true);
 }