d
This commit is contained in:
parent
db301ead3c
commit
580d586b2d
@ -142,11 +142,14 @@ namespace YD_AllHeartRates.Api.Services.Impl
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<bool> AddDevice([FromBody] AddDeviceDto dto)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(dto.StudentNo))
|
||||
{
|
||||
var student = await _sportsContext.Student.Where(x => x.StudentNo == dto.StudentNo).FirstOrDefaultAsync();
|
||||
|
||||
if (student != null)
|
||||
throw new Exception($"学号:{dto.StudentNo}的学生已存在!");
|
||||
}
|
||||
|
||||
var device = await _sportsContext.Device.Where(x => x.Code == dto.Code).FirstOrDefaultAsync();
|
||||
|
||||
@ -180,10 +183,13 @@ namespace YD_AllHeartRates.Api.Services.Impl
|
||||
if (device == null)
|
||||
throw new Exception("更新的设备不存在");
|
||||
|
||||
if (!string.IsNullOrWhiteSpace(dto.StudentNo))
|
||||
{
|
||||
var student = await _sportsContext.Student.Where(x => x.StudentNo == dto.StudentNo).FirstOrDefaultAsync();
|
||||
|
||||
if (student != null)
|
||||
throw new Exception($"学号:{dto.StudentNo}的学生已存在!");
|
||||
}
|
||||
|
||||
device.StudentNo = dto.StudentNo;
|
||||
device.DeviceType = dto.DeviceType;
|
||||
|
Loading…
x
Reference in New Issue
Block a user