|
|
@ -68,19 +68,26 @@ namespace Shentun.WebPeis.AppointScheduleTimes |
|
|
/// <param name="input"></param>
|
|
|
/// <param name="input"></param>
|
|
|
/// <returns></returns>
|
|
|
/// <returns></returns>
|
|
|
[HttpPost("api/app/AppointScheduleTime/UpdateAppointScheduleTimeNumberLimit")] |
|
|
[HttpPost("api/app/AppointScheduleTime/UpdateAppointScheduleTimeNumberLimit")] |
|
|
public async Task UpdateAppointScheduleTimeNumberLimitAsync(UpdateAppointScheduleTimeNumberLimitInputDto input) |
|
|
|
|
|
|
|
|
public async Task UpdateAppointScheduleTimeNumberLimitAsync(List<UpdateAppointScheduleTimeNumberLimitInputDto> input) |
|
|
{ |
|
|
{ |
|
|
var appointScheduleTimeEnt = await _appointScheduleTimeRepository.FirstOrDefaultAsync(f => f.AppointScheduleTimeId == input.AppointScheduleTimeId); |
|
|
|
|
|
|
|
|
if (input.Any()) |
|
|
|
|
|
{ |
|
|
|
|
|
foreach (var item in input) |
|
|
|
|
|
{ |
|
|
|
|
|
var appointScheduleTimeEnt = await _appointScheduleTimeRepository.FirstOrDefaultAsync(f => f.AppointScheduleTimeId == item.AppointScheduleTimeId); |
|
|
|
|
|
|
|
|
if (appointScheduleTimeEnt == null) |
|
|
|
|
|
throw new UserFriendlyException("预约计划明细ID不正确"); |
|
|
|
|
|
|
|
|
if (appointScheduleTimeEnt == null) |
|
|
|
|
|
throw new UserFriendlyException("预约计划明细ID不正确"); |
|
|
|
|
|
|
|
|
if (appointScheduleTimeEnt.AppointNumber > input.NumberLimit) |
|
|
|
|
|
throw new UserFriendlyException("人数限制不能小于当前已预约数量"); |
|
|
|
|
|
|
|
|
if (appointScheduleTimeEnt.AppointNumber > item.NumberLimit) |
|
|
|
|
|
throw new UserFriendlyException("人数限制不能小于当前已预约数量"); |
|
|
|
|
|
|
|
|
appointScheduleTimeEnt.NumberLimit = input.NumberLimit; |
|
|
|
|
|
|
|
|
appointScheduleTimeEnt.NumberLimit = item.NumberLimit; |
|
|
|
|
|
|
|
|
await _appointScheduleTimeRepository.UpdateAsync(appointScheduleTimeEnt); |
|
|
|
|
|
|
|
|
await _appointScheduleTimeRepository.UpdateAsync(appointScheduleTimeEnt); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |