public void DeleteForm(string keyValue) { if (service.IQueryable().Count(t => t.ListingId.Equals(keyValue)) > 0) { throw new Exception("删除失败!操作的对象包含了下级数据。"); } else { service.Delete(t => t.F_Id == keyValue); } }
public IActionResult DeleteListing(int id) { var result = listingRepo.Delete(id); return(RedirectToAction(nameof(Listings)));; }