public void Update(MocTrongLuc mocTrongLuc)
 {
     MocTrongLuc moc = this.GetMocTrongLucByID(mocTrongLuc.OBJECTID);
     moc.TinhTrang = mocTrongLuc.TinhTrang;
     db.SubmitChanges();
 }
        public ActionResult CapNhat(int id, int loai, int tt)
        {
            try
            {
                if (loai == 1)
                {
                    MocToaDo moctd = new MocToaDo();
                    moctd = _moctoado.GetMocToaDoByID(id);
                    moctd.TinhTrang = tt;
                    _moctoado.Update(moctd);

                }
                else if (loai == 2)
                {
                    MocDoCao mocdc = new MocDoCao();
                    mocdc = _mocdocao.GetMocDoCaoByID(id);
                    mocdc.TinhTrang = tt;
                    _mocdocao.Update(mocdc);

                }
                else if (loai == 3)
                {
                    MocTrongLuc moctl = new MocTrongLuc();
                    moctl = _moctrongluc.GetMocTrongLucByID(id);
                    moctl.TinhTrang = tt;
                    _moctrongluc.Update(moctl);

                }
               // throw new Exception();
            }
            catch
            {
                MessageHelper.CreateMessage(MessageType.Error, "", new List<string>{"Cập nhật tình trạng mốc không thành công.\n Vui lòng thử lại."}, HttpContext.Response);
               // return View("chitiet", new { id =id, loai=loai});
            }
            return RedirectToAction("ChiTiet", new { id = id, loai = loai });
        }
 public void Delete(MocTrongLuc mocTrongLuc)
 {
     db.MocTrongLucs.DeleteOnSubmit(mocTrongLuc);
     db.SubmitChanges();
 }