diff --git a/CompanyManagment.Application/CustomizeWorkshopSettingsApplication.cs b/CompanyManagment.Application/CustomizeWorkshopSettingsApplication.cs index 0167d8c4..b4f19256 100644 --- a/CompanyManagment.Application/CustomizeWorkshopSettingsApplication.cs +++ b/CompanyManagment.Application/CustomizeWorkshopSettingsApplication.cs @@ -154,7 +154,7 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo } - var offDays = command.OffDays.Select(x => new WeeklyOffDay(x)).ToList(); + var offDays = command.OffDays?.Select(x => new WeeklyOffDay(x)).ToList()??[]; var record = new CustomizeWorkshopSettings(workshopId, shiftCollection, command.LeavePermittedDays, command.WorkshopShiftStatus, command.HolidayWork, offDays); @@ -390,7 +390,7 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo //var commandOffDayHashSet = command.WeeklyOffDays.ToHashSet(); var commandOffDayHashSet = command.WeeklyOffDays?.ToHashSet() ?? []; - var groupOffDayHashSet = customizeWorkshopGroupSettings.WeeklyOffDays.Select(x => x.DayOfWeek).ToHashSet(); + var groupOffDayHashSet = customizeWorkshopGroupSettings.WeeklyOffDays?.Select(x => x.DayOfWeek).ToHashSet()??[]; if (command.WorkshopShiftStatus == WorkshopShiftStatus.Regular) { @@ -669,7 +669,7 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo #endregion - var offDays = weeklyOffDays.Select(x => new WeeklyOffDay(x)).ToList(); + var offDays = weeklyOffDays?.Select(x => new WeeklyOffDay(x)).ToList()??[]; using var transActionScope = new TransactionScope(); entity.ChangeWorkshopShifts(shiftCollection, workshopShiftStatus, holidayWork, offDays); @@ -723,7 +723,7 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo //var commandOffDayHashSet = command.OffDayOfWeeks.ToHashSet(); var commandOffDayHashSet = command.OffDayOfWeeks?.ToHashSet() ?? []; - var workshopOffDayHashSet = workshopSettings.WeeklyOffDays.Select(x => x.DayOfWeek).ToHashSet(); + var workshopOffDayHashSet = workshopSettings.WeeklyOffDays?.Select(x => x.DayOfWeek).ToHashSet()??[]; if (command.WorkshopShiftStatus == WorkshopShiftStatus.Regular) { @@ -871,7 +871,7 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo bool isChanged = false; var commandOffDayHashSet = command.WeeklyOffDays?.ToHashSet()??[]; - var groupOffDayHashSet = groupSettings.WeeklyOffDays.Select(x => x.DayOfWeek).ToHashSet(); + var groupOffDayHashSet = groupSettings.WeeklyOffDays?.Select(x => x.DayOfWeek).ToHashSet()??[]; if (command.WorkshopShiftStatus == WorkshopShiftStatus.Regular) { @@ -1034,7 +1034,7 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo } - var weeklyOffDays = command.WeeklyOffDays.Select(x => new WeeklyOffDay(x)).ToList(); + var weeklyOffDays = command.WeeklyOffDays?.Select(x => new WeeklyOffDay(x)).ToList()??[]; using var transaction = new TransactionScope(); entity.SimpleEdit(employeesShifts, command.IrregularShift, command.WorkshopShiftStatus, command.BreakTime, @@ -1442,7 +1442,7 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo var commandOffDayHashSet = command.WeeklyOffDays?.ToHashSet()??[]; - var entityOffDayHashSet = entity.WeeklyOffDays.Select(x => x.DayOfWeek).ToHashSet(); + var entityOffDayHashSet = entity.WeeklyOffDays?.Select(x => x.DayOfWeek).ToHashSet()??[]; bool isChanged; if (fridayPay == entity.FridayPay && overTimePay == entity.OverTimePay && baseYearsPay == entity.BaseYearsPay && bonusesPay == entity.BonusesPay @@ -1536,7 +1536,7 @@ public class CustomizeWorkshopSettingsApplication(ICustomizeWorkshopSettingsRepo }).ToList(), //FridayWork = entity.FridayWork, HolidayWork = entity.HolidayWork, - WeeklyOffDays = entity.WeeklyOffDays.Select(x=>x.DayOfWeek).ToList(), + WeeklyOffDays = entity.WeeklyOffDays?.Select(x=>x.DayOfWeek).ToList()??[], CustomizeRotatingShiftsViewModels = entity.CustomizeRotatingShifts.Select(x => new CustomizeRotatingShiftsViewModel() { StartTime = x.StartTime.ToString("HH:mm"),