fix .
This commit is contained in:
@@ -89,9 +89,6 @@ public class BusinessPlaceShiftService : IBusinessPlaceShiftService
|
||||
public async Task SaveMealShiftsAsync(List<BusinessPlaceShiftSaveMealShiftRequest> requests)
|
||||
{
|
||||
var shiftCode = requests[0].ShiftCode;
|
||||
|
||||
await _dbContext.Deleteable<BusinessShiftMealRelationshipEntity>().Where(x => x.ShiftCode == shiftCode).ExecuteCommandAsync();
|
||||
|
||||
var shift = await CheckExistsShiftAsync(shiftCode);
|
||||
|
||||
foreach (var request in requests)
|
||||
@@ -112,7 +109,10 @@ public class BusinessPlaceShiftService : IBusinessPlaceShiftService
|
||||
}
|
||||
else
|
||||
{
|
||||
var entity = await _dbContext.Queryable<BusinessShiftMealRelationshipEntity>().FirstAsync(x => x.Id == request.Id);
|
||||
var entity = await _dbContext.Queryable<BusinessShiftMealRelationshipEntity>()
|
||||
.Where(x => x.ShiftCode == shiftCode)
|
||||
.SingleAsync(x => x.Id == request.Id);
|
||||
|
||||
entity.ThrowIfNull("餐次段不存在");
|
||||
|
||||
entity.Start = request.TimePeriod.Start.Value;
|
||||
@@ -258,7 +258,7 @@ public class BusinessPlaceShiftService : IBusinessPlaceShiftService
|
||||
.Select(x => new TimePeriod
|
||||
{
|
||||
Start = x.Start,
|
||||
End = x.End,
|
||||
End = x.End
|
||||
})
|
||||
.ToListAsync();
|
||||
|
||||
@@ -286,7 +286,7 @@ public class BusinessPlaceShiftService : IBusinessPlaceShiftService
|
||||
|
||||
private async Task<BusinessShiftEntity> CheckExistsShiftAsync(Guid shiftCode)
|
||||
{
|
||||
var shift = await _dbContext.Queryable<BusinessShiftEntity>().Where(x => x.Code == shiftCode).FirstAsync();
|
||||
var shift = await _dbContext.Queryable<BusinessShiftEntity>().Where(x => x.Code == shiftCode).SingleAsync();
|
||||
shift.ThrowIfNull("餐次不存在");
|
||||
|
||||
return shift;
|
||||
|
||||
Reference in New Issue
Block a user