Exemple #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"));
        }
 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));
 }
Exemple #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"));
 }
Exemple #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));
        }
        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"));
        }
        // 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));
        }