forked from ddrilling/AsbCloudServer
Дписан комментарий к методу, убран лишний код
This commit is contained in:
parent
a9d365908b
commit
dad0480f59
@ -61,6 +61,14 @@ namespace AsbCloudApp.Services
|
|||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
Task<int> DeleteAsync(int idWell, int id, CancellationToken token);
|
Task<int> DeleteAsync(int idWell, int id, CancellationToken token);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Перенос контактов из скважины на скважину
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="idWell">ключ текущей скважины</param>
|
||||||
|
/// <param name="idWellTarget">ключ новой скважины</param>
|
||||||
|
/// <param name="contactIds">ключи контактов</param>
|
||||||
|
/// <param name="token"></param>
|
||||||
|
/// <returns></returns>
|
||||||
Task<int> CopyAsync(int idWell, int idWellTarget, IEnumerable<int> contactIds, CancellationToken token);
|
Task<int> CopyAsync(int idWell, int idWellTarget, IEnumerable<int> contactIds, CancellationToken token);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -34,19 +34,6 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
return entities;
|
return entities;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<IEnumerable<ContactDto>> GetAllAsync(int wellId, IEnumerable<int> contactIds, CancellationToken token)
|
|
||||||
{
|
|
||||||
var query = db.Contacts
|
|
||||||
.Where(c => c.IdWell == wellId)
|
|
||||||
.Where(c => contactIds.Contains(c.Id))
|
|
||||||
.Select(c => c.Adapt<ContactDto>());
|
|
||||||
|
|
||||||
var entities = await query.AsNoTracking()
|
|
||||||
.ToArrayAsync(token);
|
|
||||||
|
|
||||||
return entities;
|
|
||||||
}
|
|
||||||
|
|
||||||
public async Task<ContactDto?> GetAsync(int idWell, int id, CancellationToken token)
|
public async Task<ContactDto?> GetAsync(int idWell, int id, CancellationToken token)
|
||||||
{
|
{
|
||||||
var dbContact = await GetContact(idWell, id, token);
|
var dbContact = await GetContact(idWell, id, token);
|
||||||
@ -110,6 +97,7 @@ namespace AsbCloudInfrastructure.Services
|
|||||||
foreach (var dbContact in dbContacts)
|
foreach (var dbContact in dbContacts)
|
||||||
{
|
{
|
||||||
dbContact.IdWell = idWellTarget;
|
dbContact.IdWell = idWellTarget;
|
||||||
|
dbContact.Id = default;
|
||||||
}
|
}
|
||||||
|
|
||||||
await db.Contacts.AddRangeAsync(dbContacts);
|
await db.Contacts.AddRangeAsync(dbContacts);
|
||||||
|
@ -147,7 +147,7 @@ namespace AsbCloudWebApi.Controllers
|
|||||||
/// <param name="contactIds"></param>
|
/// <param name="contactIds"></param>
|
||||||
/// <param name="token"></param>
|
/// <param name="token"></param>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
[HttpPost("copy/{id}")]
|
[HttpPost("copy/{idWellTarget}")]
|
||||||
[Permission]
|
[Permission]
|
||||||
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
[ProducesResponseType(typeof(int), (int)System.Net.HttpStatusCode.OK)]
|
||||||
public async Task<IActionResult> CopyAsync(
|
public async Task<IActionResult> CopyAsync(
|
||||||
|
Loading…
Reference in New Issue
Block a user