#5998816 edit result dto

This commit is contained in:
ai.astrakhantsev 2022-09-12 10:05:04 +05:00
parent de54067344
commit 7fda09f617
4 changed files with 35 additions and 11 deletions

View File

@ -0,0 +1,26 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace AsbCloudApp.Data
{
#nullable enable
/// <summary>
/// Дела скважины
/// </summary>
public class WellCaseDto
{
/// <summary>
/// Скважина
/// </summary>
public int IdWell { get; set; }
/// <summary>
/// Документ дела скважины
/// </summary>
public IEnumerable<WellFinalDocumentDto> WellFinalDocuments { get; set; } = Enumerable.Empty<WellFinalDocumentDto>();
}
#nullable disable
}

View File

@ -9,11 +9,6 @@ namespace AsbCloudApp.Data
/// </summary>
public class WellFinalDocumentDto
{
/// <summary>
/// Скважина
/// </summary>
public int IdWell { get; set; }
/// <summary>
/// Наименование категории файла
/// </summary>

View File

@ -27,7 +27,7 @@ namespace AsbCloudApp.Services
/// <param name = "idWell" ></param >
/// <param name="token"></param>
/// <returns></returns>
Task<IEnumerable<WellFinalDocumentDto>> GetByWellId(int idWell, CancellationToken token);
Task<WellCaseDto> GetByWellId(int idWell, CancellationToken token);
/// <summary>
/// Получение списка ответственных

View File

@ -77,9 +77,9 @@ namespace AsbCloudInfrastructure.Services
throw new ArgumentInvalidException("Данные по категориям отсутствуют.");
}
public async Task<IEnumerable<WellFinalDocumentDto>> GetByWellId(int idWell, CancellationToken token)
public async Task<WellCaseDto> GetByWellId(int idWell, CancellationToken token)
{
var result = new List<WellFinalDocumentDto>();
var wellFinalDocuments = new List<WellFinalDocumentDto>();
var wells = await context.WellFinalDocuments.Where(x => x.IdWell == idWell)
.ToListAsync(token)
@ -121,8 +121,8 @@ namespace AsbCloudInfrastructure.Services
.FirstOrDefault();
}
result.Add(new WellFinalDocumentDto {
IdWell = idWell,
wellFinalDocuments.Add(new WellFinalDocumentDto {
NameCategory = item.NameCategory,
Publishers = allUsers.Where(x => userIds.Contains(x.Id)),
FilesCount = allFiles.Count(),
@ -131,7 +131,10 @@ namespace AsbCloudInfrastructure.Services
});
}
return result;
return new WellCaseDto {
IdWell = idWell,
WellFinalDocuments = wellFinalDocuments
};
}
public async Task<IEnumerable<UserDto>> GetAvailableUsersAsync(int idWell, CancellationToken token)