diff --git a/AsbCloudApp/Services/IWellContactService.cs b/AsbCloudApp/Services/IWellContactService.cs index 87239cb4..a584fad7 100644 --- a/AsbCloudApp/Services/IWellContactService.cs +++ b/AsbCloudApp/Services/IWellContactService.cs @@ -61,6 +61,14 @@ namespace AsbCloudApp.Services /// Task DeleteAsync(int idWell, int id, CancellationToken token); + /// + /// Перенос контактов из скважины на скважину + /// + /// ключ текущей скважины + /// ключ новой скважины + /// ключи контактов + /// + /// Task CopyAsync(int idWell, int idWellTarget, IEnumerable contactIds, CancellationToken token); } } diff --git a/AsbCloudInfrastructure/Services/WellContactService.cs b/AsbCloudInfrastructure/Services/WellContactService.cs index 1d83799b..2fbd9be0 100644 --- a/AsbCloudInfrastructure/Services/WellContactService.cs +++ b/AsbCloudInfrastructure/Services/WellContactService.cs @@ -34,19 +34,6 @@ namespace AsbCloudInfrastructure.Services return entities; } - public async Task> GetAllAsync(int wellId, IEnumerable contactIds, CancellationToken token) - { - var query = db.Contacts - .Where(c => c.IdWell == wellId) - .Where(c => contactIds.Contains(c.Id)) - .Select(c => c.Adapt()); - - var entities = await query.AsNoTracking() - .ToArrayAsync(token); - - return entities; - } - public async Task GetAsync(int idWell, int id, CancellationToken token) { var dbContact = await GetContact(idWell, id, token); @@ -110,6 +97,7 @@ namespace AsbCloudInfrastructure.Services foreach (var dbContact in dbContacts) { dbContact.IdWell = idWellTarget; + dbContact.Id = default; } await db.Contacts.AddRangeAsync(dbContacts); diff --git a/AsbCloudWebApi/Controllers/WellContactController.cs b/AsbCloudWebApi/Controllers/WellContactController.cs index 089355b9..bdb6a7ae 100644 --- a/AsbCloudWebApi/Controllers/WellContactController.cs +++ b/AsbCloudWebApi/Controllers/WellContactController.cs @@ -147,7 +147,7 @@ namespace AsbCloudWebApi.Controllers /// /// /// - [HttpPost("copy/{id}")] + [HttpPost("copy/{idWellTarget}")] [Permission] [ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)] public async Task CopyAsync(