public void DeleteTaiNguyen(int id) { WebPortal.TaiNguyen_TinTuc taiNguyenTinTuc = new TaiNguyen_TinTuc(); WebPortal.TaiNguyen taiNguyen = new TaiNguyen(); List<WebPortal.Model.TaiNguyen_TinTuc> list = taiNguyenTinTuc.GetFollowIDTaiNguyen(id); foreach (WebPortal.Model.TaiNguyen_TinTuc tntt in list) { taiNguyenTinTuc.Delete(tntt.ID); } taiNguyen.Delete(id); }
public void DeleteTaiNguyenAttached(int idTaiNguyen, int idTinTuc) { try { WebPortal.TaiNguyen taiNguyen = new TaiNguyen(); WebPortal.Model.TaiNguyen tn = taiNguyen.Single(idTaiNguyen); Libs.LibFile.DeleteFile(tn.Path); taiNguyen.Delete(idTaiNguyen); DeleteStatus.Text = "Xóa thành công"; } catch (Exception ex) { DeleteStatus.Text = "Lỗi xảy ra khi xóa! Vui lòng thử lại."; } }