Пример #1
0
 public ActionResult Add(DanhMucLon model)
 {
     using (var ctx = new QLDauGiaEntities())
     {
         ctx.DanhMucLon.Add(model);
         ctx.SaveChanges();
     }
     return(View());
 }
Пример #2
0
 public ActionResult Update(DanhMucLon model)
 {
     using (var ctx = new QLDauGiaEntities())
     {
         ctx.Entry(model).State =
             System.Data.Entity.EntityState.Modified;
         ctx.SaveChanges();
     }
     return(RedirectToAction("XuatDanhMuc", "DanhMuc"));
 }
Пример #3
0
 public ActionResult Delete(int idToDelete)
 {
     using (var ctx = new QLDauGiaEntities())
     {
         DanhMucLon model = ctx.DanhMucLon
                            .Where(c => c.ID == idToDelete)
                            .FirstOrDefault();
         model.TinhTrang = true;
         ctx.SaveChanges();
     }
     return(RedirectToAction("XuatDanhMuc", "DanhMuc"));
 }
Пример #4
0
        //hàm Edit ở đây
        public ActionResult Edit(int?id)
        {
            if (id.HasValue == false)
            {
                return(RedirectToAction("XuatDanhMuc", "DanhMuc"));
            }
            using (var ctx = new QLDauGiaEntities())
            {
                DanhMucLon model = ctx.DanhMucLon
                                   .Where(c => c.ID == id)
                                   .FirstOrDefault();


                return(View(model));
            }
        }