public ActionResult Delete(HocViens HocVien)
        {
            var hocVien = _hocVienService.Get(HocVien.Id);

            if (hocVien == null)
            {
                return(NotFound());
            }
            _hocVienService.Delete(HocVien);
            return(Ok());
        }
Esempio n. 2
0
 private void btnDelete_Click(object sender, EventArgs e)
 {
     objState = EntityState.Deleted;
     if (MetroFramework.MetroMessageBox.Show(this, "Bạn có chắc muốn xóa không?", "Message", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
     {
         try
         {
             DTO.HocVien obj = bindingSource1.Current as DTO.HocVien;
             if (obj != null)
             {
                 bool result = HocVienService.Delete(obj.MaHV);
                 if (result)
                 {
                     bindingSource1.RemoveCurrent();
                     //pContainer.Enabled = False
                     pic.Image = null;
                     objState  = EntityState.Unchanged;
                 }
             }
         }
         catch (Exception ex)
         {
             MetroFramework.MetroMessageBox.Show(this, ex.Message, "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }