forked from ddrilling/AsbCloudServer
nit refactor WellService.UpdateWellAsync(..) throw exception instad of return null
This commit is contained in:
parent
54d78ddd0e
commit
e92859439e
@ -47,17 +47,17 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
CancellationToken token = default)
|
CancellationToken token = default)
|
||||||
{
|
{
|
||||||
if (dto.IdWellType is < 1 or > 2)
|
if (dto.IdWellType is < 1 or > 2)
|
||||||
throw new ArgumentException("Тип секции указан неправильно.");
|
throw new ArgumentException("Тип секции указан неправильно.", nameof(dto));
|
||||||
|
|
||||||
if (dto.State is < 0 or > 2)
|
if (dto.State is < 0 or > 2)
|
||||||
throw new ArgumentException("Текущее состояние работы скважины" +
|
throw new ArgumentException("Текущее состояние работы скважины" +
|
||||||
"указано неправильно.");
|
"указано неправильно.", nameof(dto));
|
||||||
var well = await db.Wells
|
var well = await db.Wells
|
||||||
.FirstOrDefaultAsync(w => w.Id == idWell, token)
|
.FirstOrDefaultAsync(w => w.Id == idWell, token)
|
||||||
.ConfigureAwait(false);
|
.ConfigureAwait(false);
|
||||||
|
|
||||||
if (well is null)
|
if (well is null)
|
||||||
return null;
|
throw new ArgumentException("Тип секции указан неправильно.", nameof(idWell));
|
||||||
|
|
||||||
well.Caption = dto.Caption;
|
well.Caption = dto.Caption;
|
||||||
well.Latitude = dto.Latitude;
|
well.Latitude = dto.Latitude;
|
||||||
|
Loading…
Reference in New Issue
Block a user