示例#1
0
 // GET: TTNV/Delete/5
 public ActionResult Delete(int id)
 {
     using (HopLucShopEntities db = new HopLucShopEntities())
     {
         return(View(db.NhanVienBH.SingleOrDefault(x => x.ID_NV == id)));
     }
 }
示例#2
0
 // GET: TTNV
 public ActionResult Index()
 {
     using (HopLucShopEntities db = new HopLucShopEntities())
     {
         return(View(db.NhanVienBH.ToList()));
     }
 }
示例#3
0
 public ActionResult Edit(int id, NhanVienBH bH)
 {
     try
     {
         // TODO: Add update logic here
         using (HopLucShopEntities db = new HopLucShopEntities())
         {
             db.Entry(bH).State = EntityState.Modified;
             db.SaveChanges();
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
示例#4
0
 public ActionResult Delete(int id, FormCollection collection)
 {
     try
     {
         // TODO: Add delete logic here
         using (HopLucShopEntities db = new HopLucShopEntities())
         {
             NhanVienBH vienBH = db.NhanVienBH.Where(x => x.ID_NV == id).FirstOrDefault();
             db.NhanVienBH.Remove(vienBH);
             db.SaveChanges();
         }
         return(RedirectToAction("Index"));
     }
     catch
     {
         return(View());
     }
 }
示例#5
0
        public ActionResult Create(NhanVienBH bH)
        {
            try
            {
                using (HopLucShopEntities db = new HopLucShopEntities())
                {
                    db.NhanVienBH.Add(bH);
                    db.SaveChanges();
                }
                // TODO: Add insert logic here

                return(RedirectToAction("Index"));
            }
            catch
            {
                return(View());
            }
        }