예제 #1
0
        public ActionResult xoakhachhang(string id)
        {
            Models.DIENKE dIENKE = dc.DIENKEs.Find(id);
            if (dIENKE != null)
            {
                dc.DIENKEs.Remove(dIENKE);
                dc.SaveChanges();
            }

            return(RedirectToAction("IndexDK"));
        }
예제 #2
0
 public ActionResult suadienke(Models.DIENKE dIENKE)
 {
     Models.DIENKE iENKE = dc.DIENKEs.Find(dIENKE.Madk);
     if (ModelState.IsValid)
     {
         iENKE.Makh      = dIENKE.Makh;
         iENKE.Ngaysx    = dIENKE.Ngaysx;
         iENKE.Ngaylap   = dIENKE.Ngaylap;
         iENKE.Mota      = dIENKE.Mota;
         iENKE.Trangthai = dIENKE.Trangthai;
         dc.SaveChanges();
         return(RedirectToAction("IndexDK"));
     }
     ViewBag.DSkh = dc.KHACHHANGs.ToList();
     return(View("Formsuadienke"));
 }
예제 #3
0
        public ActionResult Formxoadienke(string id)
        {
            bool coXoa = true;

            Models.DIENKE dIENKE = dc.DIENKEs.Find(id);
            foreach (var item in dc.CTHOADONs.Where(x => x.Madk == id))
            {
                coXoa = false;
                break;
            }
            ViewBag.Xoakh = coXoa;
            if (dIENKE != null)
            {
                return(View(dIENKE));
            }
            return(RedirectToAction("IndexDK"));
        }
예제 #4
0
 public ActionResult themdienke(Models.DIENKE dIENKE)
 {
     if (ModelState.IsValid)
     {
         Models.DIENKE matontai = dc.DIENKEs.Find(dIENKE.Madk);
         if (matontai != null)
         {
             ModelState.AddModelError("Madk", "Đã có mã này");
         }
         else
         {
             dc.DIENKEs.Add(dIENKE);
             dc.SaveChanges();
             return(RedirectToAction("IndexDK"));
         }
     }
     ViewBag.DSkh = dc.KHACHHANGs.ToList();
     return(View("Formthemdienke"));
 }
예제 #5
0
 public ActionResult Formsuadienke(string id)
 {
     ViewBag.DSkh = dc.KHACHHANGs.ToList();
     Models.DIENKE dIENKE = dc.DIENKEs.Find(id);
     return(View(dIENKE));
 }