public JsonResult DeleteNote(int id) { _crmPotentialActivityRepository.Delete(id); _unitOfWork.Commit(); return(Json(true)); }
public bool Delete(int id) { // Check whether Potential exists or not ? var crmPotential = _crmPotentialRepository.Get(id); if (crmPotential != null) { // Delete all Potential Activities var activities = _crmPotentialActivityRepository.GetAllBy(m => m.CRMPotentialId == id).ToList(); foreach (var activity in activities) { _crmPotentialActivityRepository.Delete(activity); } // Delete all Potential Technology Maps var technologies = _crmPotentialTechnologyMapRepository.GetAllBy(m => m.PotentialId == id).ToList(); foreach (var technology in technologies) { _crmPotentialTechnologyMapRepository.Delete(technology); } _unitOfWork.Commit(); _crmPotentialRepository.Delete(id); _unitOfWork.Commit(); return(true); } return(false); }