From cf298690a48662cdc4caff4e3935224fd53294a8 Mon Sep 17 00:00:00 2001 From: Olga Nemt Date: Mon, 16 Oct 2023 10:56:10 +0500 Subject: [PATCH] =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B5=D0=B8=D0=BC=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=D0=B2=D0=B0=D0=BD=20=D0=BC=D0=B5=D1=82=D0=BE=D0=B4?= =?UTF-8?q?=20=D0=BF=D0=BE=D0=BB=D1=83=D1=87=D0=B5=D0=BD=D0=B8=D1=8F=20?= =?UTF-8?q?=D0=BA=D0=BE=D0=BD=D1=82=D0=B0=D0=BA=D1=82=D0=B0=20=D0=BF=D0=BE?= =?UTF-8?q?=20=D0=BA=D0=BB=D1=8E=D1=87=D1=83=20=D0=BA=D0=BE=D0=BD=D1=82?= =?UTF-8?q?=D0=B0=D0=BA=D1=82=D0=B0=20=D0=B8=20=D0=BA=D0=BB=D1=8E=D1=87?= =?UTF-8?q?=D1=83=20=D1=81=D0=BA=D0=B2=D0=B0=D0=B6=D0=B8=D0=BD=D1=8B:=20Ge?= =?UTF-8?q?tContact,=20=D1=83=D0=B1=D1=80=D0=B0=D0=BD=D1=8B=20=20Configure?= =?UTF-8?q?Await(false)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- AsbCloudApp/Services/IWellContactService.cs | 2 +- .../Services/WellContactService.cs | 19 +++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/AsbCloudApp/Services/IWellContactService.cs b/AsbCloudApp/Services/IWellContactService.cs index f9b9f7a0..8cbe8328 100644 --- a/AsbCloudApp/Services/IWellContactService.cs +++ b/AsbCloudApp/Services/IWellContactService.cs @@ -24,7 +24,7 @@ namespace AsbCloudApp.Services /// Получение контакта по ключу /// /// ключ скважины - /// тип пользователя + /// ключ пользователя /// /// Task GetAsync(int idWell, int id, CancellationToken token); diff --git a/AsbCloudInfrastructure/Services/WellContactService.cs b/AsbCloudInfrastructure/Services/WellContactService.cs index de6d59fe..7a2a5a07 100644 --- a/AsbCloudInfrastructure/Services/WellContactService.cs +++ b/AsbCloudInfrastructure/Services/WellContactService.cs @@ -29,15 +29,14 @@ namespace AsbCloudInfrastructure.Services .Select(c => c.Adapt()); var entities = await query.AsNoTracking() - .ToArrayAsync(token) - .ConfigureAwait(false); + .ToArrayAsync(token); return entities; } public async Task GetAsync(int idWell, int id, CancellationToken token) { - var dbContact = await CheckMembershipContactToWell(idWell, id, token); + var dbContact = await GetContact(idWell, id, token); var result = dbContact?.Adapt(); @@ -51,8 +50,7 @@ namespace AsbCloudInfrastructure.Services .OrderBy(t => t.Order); var entities = await query.AsNoTracking() - .ToArrayAsync(token) - .ConfigureAwait(false); + .ToArrayAsync(token); var dtos = entities.Adapt>(); @@ -75,16 +73,14 @@ namespace AsbCloudInfrastructure.Services var entity = contactDto.Adapt(); db.Contacts.Update(entity); - return await db.SaveChangesAsync(token) - .ConfigureAwait(false); + return await db.SaveChangesAsync(token); } public async Task DeleteAsync(int id, CancellationToken token) { var contact = await db.Contacts .Where(c => c.Id == id) - .FirstOrDefaultAsync(token) - .ConfigureAwait(false); + .FirstOrDefaultAsync(token); if (contact is null) throw new ForbidException("Contact doesn't exist"); @@ -93,13 +89,12 @@ namespace AsbCloudInfrastructure.Services return await db.SaveChangesAsync(token); } - private async Task CheckMembershipContactToWell(int idWell, int idContact, CancellationToken token) + private async Task GetContact(int idWell, int idContact, CancellationToken token) { var contact = await db.Contacts .Where(c => c.IdWell == idWell) .Where(c => c.Id == idContact) - .FirstOrDefaultAsync(token) - .ConfigureAwait(false); + .FirstOrDefaultAsync(token); return contact; }