.
This commit is contained in:
parent
317cf4e81e
commit
ca4f50d69b
@ -143,6 +143,11 @@ namespace YD_AllHeartRates.Api.Services.Impl
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public async Task<bool> AddDevice([FromBody] AddDeviceDto dto)
|
public async Task<bool> AddDevice([FromBody] AddDeviceDto dto)
|
||||||
{
|
{
|
||||||
|
var student = await _sportsContext.Student.Where(x => x.StudentNo == dto.StudentNo).FirstOrDefaultAsync();
|
||||||
|
|
||||||
|
if (student == null)
|
||||||
|
throw new Exception($"学号:{dto.StudentNo}的学生不存在!");
|
||||||
|
|
||||||
var entity = new S_Device()
|
var entity = new S_Device()
|
||||||
{
|
{
|
||||||
Code = dto.Code,
|
Code = dto.Code,
|
||||||
@ -169,6 +174,11 @@ namespace YD_AllHeartRates.Api.Services.Impl
|
|||||||
if (device == null)
|
if (device == null)
|
||||||
throw new Exception("更新的设备不存在");
|
throw new Exception("更新的设备不存在");
|
||||||
|
|
||||||
|
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.StudentNo = dto.StudentNo;
|
||||||
device.DeviceType = dto.DeviceType;
|
device.DeviceType = dto.DeviceType;
|
||||||
device.Name = dto.DeviceType == 1 ? "心率" : "跳绳";
|
device.Name = dto.DeviceType == 1 ? "心率" : "跳绳";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user