Изменен путь до контроллера получения документов

This commit is contained in:
KharchenkoVV 2021-07-26 17:26:07 +05:00
parent d165c809df
commit 1325663d7e
2 changed files with 8 additions and 8 deletions

View File

@ -53,27 +53,27 @@ namespace AsbCloudInfrastructure.Services
if (telemetry is null) if (telemetry is null)
return null; return null;
var filesInfoFromDb = db.Files.Include(f => f.User) var filesInfoQuery = db.Files.Include(f => f.User)
.Where(f => f.IdWell == wellId && .Where(f => f.IdWell == wellId &&
f.IdCategory == idCategory); f.IdCategory == idCategory);
if (!filesInfoFromDb.Any()) if (!filesInfoQuery.Any())
return null; return null;
var result = new PaginationContainer<FilePropertiesDto>() { Skip = skip, Take = take }; var result = new PaginationContainer<FilePropertiesDto>() { Skip = skip, Take = take };
if (begin != default) if (begin != default)
filesInfoFromDb = filesInfoFromDb.Where(m => m.Date >= begin); filesInfoQuery = filesInfoQuery.Where(m => m.Date >= begin);
if (end != default) if (end != default)
filesInfoFromDb = filesInfoFromDb.Where(m => m.Date <= end); filesInfoQuery = filesInfoQuery.Where(m => m.Date <= end);
result.Count = filesInfoFromDb.Count(); result.Count = filesInfoQuery.Count();
if (skip > 0) if (skip > 0)
filesInfoFromDb = filesInfoFromDb.Skip(skip); filesInfoQuery = filesInfoQuery.Skip(skip);
var filesInfoList = filesInfoFromDb.Take(take).ToList(); var filesInfoList = filesInfoQuery.Take(take).ToList();
if (filesInfoList.Count == 0) if (filesInfoList.Count == 0)
return result; return result;

View File

@ -79,7 +79,7 @@ namespace AsbCloudWebApi.Controllers
/// <param name="take">для пагинации кол-во записей взять </param> /// <param name="take">для пагинации кол-во записей взять </param>
/// <returns>Список информации о файлах в этой категории</returns> /// <returns>Список информации о файлах в этой категории</returns>
[HttpGet] [HttpGet]
[Route("{wellId}/filesInfo")] [Route("{wellId}")]
[ProducesResponseType(typeof(PaginationContainer<FilePropertiesDto>), (int)System.Net.HttpStatusCode.OK)] [ProducesResponseType(typeof(PaginationContainer<FilePropertiesDto>), (int)System.Net.HttpStatusCode.OK)]
public IActionResult GetFilesInfo([FromRoute] int wellId, public IActionResult GetFilesInfo([FromRoute] int wellId,
int skip = 0, int take = 32, int idCategory = default, int skip = 0, int take = 32, int idCategory = default,