public void DeleteComplaint(int id) { //unitOfWork.StartTransaction(); ComplaintRepository repo = new ComplaintRepository(unitOfWork); ComplaintModel complaintModel = new ComplaintModel(); Complaint complaint = new Complaint(); complaint = repo.GetAll().Where(x => x.ComplaintId == id).SingleOrDefault(); repo.Delete(x => x.ComplaintId == complaint.ComplaintId); //unitOfWork.Commit(); }
public void DeleteComplaintbyEmployeeId(string id) { //unitOfWork.StartTransaction(); ComplaintRepository repo = new ComplaintRepository(unitOfWork); ComplaintModel complaintModel = new ComplaintModel(); List<Complaint> complaints = new List<Complaint>(); complaints = repo.GetAll().Where(x => x.EmployeeId == id).ToList(); complaints.ForEach(x => { repo.Delete(y => y.ComplaintId == x.ComplaintId); }); //unitOfWork.Commit(); }