コード例 #1
0
        public ActionResult DeleteDV(int?IDdichvu, int?IDphong)
        {
            GiaPhong giaPhong = db.GiaPhongs.Find(IDdichvu, IDphong);

            db.GiaPhongs.Remove(giaPhong);
            db.SaveChanges();
            return(RedirectToAction("Index", "Phongs"));
        }
コード例 #2
0
 public ActionResult Edit([Bind(Include = "maDV,maphong,gia")] GiaPhong giaPhong)
 {
     if (ModelState.IsValid)
     {
         db.Entry(giaPhong).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Edit", "Phongs", new { @id = giaPhong.maphong }));
     }
     ViewBag.maDV    = new SelectList(db.DichVus, "maDV", "tenDV", giaPhong.maDV);
     ViewBag.maphong = new SelectList(db.Phongs, "maphong", "maphong", giaPhong.maphong);
     return(View(giaPhong));
 }
コード例 #3
0
 public ActionResult Edit(GiaPhong obj)
 {
     if (obj.IDGiaPhong > 0)
     {
         db.Entry(obj).State = EntityState.Modified;
     }
     else
     {
         db.GiaPhongs.Add(obj);
     }
     db.SaveChanges();
     return(RedirectToAction("Index", "Phong"));
 }
コード例 #4
0
        public ActionResult Edit(int?id, int?IDPhong)
        {
            GiaPhong obj = id > 0 ? db.GiaPhongs.Find(id) : new GiaPhong()
            {
                IDPhong = IDPhong
            };

            if (obj == null)
            {
                return(HttpNotFound());
            }
            return(View(obj));
        }
コード例 #5
0
        public ActionResult Create([Bind(Include = "maDV,maphong,gia")] GiaPhong giaPhong)
        {
            if (ModelState.IsValid)
            {
                db.GiaPhongs.Add(giaPhong);
                db.SaveChanges();
                return(RedirectToAction("Index", "Phongs"));
            }

            ViewBag.maDV    = new SelectList(db.DichVus, "maDV", "tenDV", giaPhong.maDV);
            ViewBag.maphong = new SelectList(db.Phongs, "maphong", "maphong", giaPhong.maphong);
            return(RedirectToAction("Index", "Phongs"));
        }
コード例 #6
0
        // GET: TTNhom_QLKS/GiaPhongs/Edit/5
        public ActionResult Edit(int?IDdichvu, int?IDphong)
        {
            if (IDdichvu == null || IDphong == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            GiaPhong giaPhong = db.GiaPhongs.Find(IDdichvu, IDphong);

            if (giaPhong == null)
            {
                return(HttpNotFound());
            }
            ViewBag.sophong = db.Phongs.Find(giaPhong.maphong).sophong;
            ViewBag.tenDV   = db.DichVus.Find(giaPhong.maDV).tenDV;
            return(View(giaPhong));
        }