Beispiel #1
0
 public ActionResult Add(tbl_NhaSanXuats item)
 {
     using (ModelEntities ctx = new ModelEntities())
     {
         tbl_NhaSanXuats itemAdd = new tbl_NhaSanXuats();
         itemAdd.TenNhaSanXuat = item.TenNhaSanXuat;
         itemAdd.DaXoa         = !item.DaXoa;
         ctx.tbl_NhaSanXuats.Add(itemAdd);
         ctx.SaveChanges();
         return(View());
     }
 }
Beispiel #2
0
 public ActionResult RestoreFac(int?id)
 {
     using (ModelEntities ctx = new ModelEntities())
     {
         tbl_NhaSanXuats item2 = ctx.tbl_NhaSanXuats.Where(p => p.NhaSanXuatID == id).FirstOrDefault();
         if (item2 != null)
         {
             item2.DaXoa = false;
             ctx.SaveChanges();
             return(RedirectToAction("Edit", new { id = id }));
         }
         return(RedirectToAction("Index"));
     }
 }
Beispiel #3
0
 public ActionResult Edit(tbl_NhaSanXuats item)
 {
     using (ModelEntities ctx = new ModelEntities())
     {
         tbl_NhaSanXuats item2 = ctx.tbl_NhaSanXuats.Where(p => p.NhaSanXuatID == item.NhaSanXuatID).FirstOrDefault();
         if (item2 != null)
         {
             item2.TenNhaSanXuat = item.TenNhaSanXuat;
             ctx.SaveChanges();
             return(RedirectToAction("Edit", new { id = item2.NhaSanXuatID }));
         }
         return(RedirectToAction("Index"));
     }
 }
Beispiel #4
0
 // GET: Admin/Edit
 public ActionResult Edit(int?id)
 {
     if (!id.HasValue)
     {
         return(RedirectToAction("Index"));
     }
     using (ModelEntities ctx = new ModelEntities())
     {
         tbl_NhaSanXuats item = ctx.tbl_NhaSanXuats.Where(p => p.NhaSanXuatID == id.Value).FirstOrDefault();
         if (item != null)
         {
             return(View(item));
         }
         return(RedirectToAction("Index"));
     }
 }