feat: streamline employer removal process from workshop details
This commit is contained in:
@@ -1391,12 +1391,14 @@ public class EmployerApplication : IEmployerApplication
|
||||
|
||||
// Get workshop details
|
||||
var workshopDetails =
|
||||
await _institutionContractRepository.GetInstitutionWorkshopInitialDetails(institutionWorkshopDetailsId);
|
||||
await _institutionContractRepository
|
||||
.GetInstitutionWorkshopInitialDetails(institutionWorkshopDetailsId);
|
||||
if (workshopDetails == null)
|
||||
return operation.Failed("جزئیات کارگاه موسسه یافت نشد");
|
||||
|
||||
// Find and remove the employer from workshop details
|
||||
var employerDetail = workshopDetails.Employers.FirstOrDefault(e => e.EmployerId == employerId);
|
||||
var employerDetail = workshopDetails
|
||||
.Employers.FirstOrDefault(e => e.EmployerId == employerId);
|
||||
if (employerDetail == null)
|
||||
return operation.Failed("کارفرما در لیست کارگاه یافت نشد");
|
||||
|
||||
@@ -1404,10 +1406,7 @@ public class EmployerApplication : IEmployerApplication
|
||||
workshopDetails.Employers.Remove(employerDetail);
|
||||
|
||||
await _institutionContractRepository.SaveChangesAsync();
|
||||
|
||||
// Delete the employer
|
||||
_EmployerRepository.Remove(employerId);
|
||||
await _EmployerRepository.SaveChangesAsync();
|
||||
|
||||
|
||||
return operation.Succcedded();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user