public ActionResult DeleteConfirmed(int id)
        {
            LaoDongCongIch laoDongCongIch = db.LaoDongCongIch.Find(id);

            db.LaoDongCongIch.Remove(laoDongCongIch);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
 public ActionResult Edit([Bind(Include = "ID,PhamNhanID,KhuVucLamViec,BieuHien")] LaoDongCongIch laoDongCongIch)
 {
     if (ModelState.IsValid)
     {
         var khucuaphamNhan = db.PhamNhan.Find(laoDongCongIch.PhamNhanID).IDKhu;
         var khuID          = db.Khu.FirstOrDefault(f => f.ID == khucuaphamNhan).ID;
         laoDongCongIch.QuanNgucID      = db.QuanNguc.FirstOrDefault(f => f.KhuID == khuID).ID;
         db.Entry(laoDongCongIch).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(laoDongCongIch));
 }
        // GET: LaoDongCongIches/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LaoDongCongIch laoDongCongIch = db.LaoDongCongIch.Find(id);

            if (laoDongCongIch == null)
            {
                return(HttpNotFound());
            }
            return(View(laoDongCongIch));
        }
        // GET: LaoDongCongIches/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            LaoDongCongIch laoDongCongIch = db.LaoDongCongIch.Find(id);

            if (laoDongCongIch == null)
            {
                return(HttpNotFound());
            }
            if (db.Benh.Where(w => w.PhamNhanID == laoDongCongIch.PhamNhanID && DbFunctions.DiffDays(DateTime.Now, w.NgayBatDauChuaTri) <= w.NgayChuaTri).Any())
            {
                return(RedirectToAction("Index", "LaoDongCongIches"));
            }
            return(View(laoDongCongIch));
        }