Фильтрация по категориям опреации: в ГГД выводятся только те, у которого isHidden = false

This commit is contained in:
Olga Nemt 2024-04-10 15:05:15 +05:00
parent a91d95bc2e
commit b5369c4363
4 changed files with 5 additions and 3 deletions

View File

@ -12,6 +12,6 @@ namespace AsbCloudApp.Repositories
/// список названий операций
/// </summary>
/// <returns></returns>
IEnumerable<WellOperationCategoryDto> Get(bool includeParents);
IEnumerable<WellOperationCategoryDto> Get(bool includeParents, bool includeHidden = true);
}
}

View File

@ -19,11 +19,13 @@ public class WellOperationCategoryRepository : IWellOperationCategoryRepository
this.memoryCache = memoryCache;
}
public IEnumerable<WellOperationCategoryDto> Get(bool includeParents)
public IEnumerable<WellOperationCategoryDto> Get(bool includeParents, bool includeHidden = true)
{
var categories = memoryCache
.GetOrCreateBasic(db.Set<WellOperationCategory>());
categories = categories.Where(o => includeHidden ? true : o.IsHidden == false);
if (!includeParents)
{
var parentIds = categories

View File

@ -172,7 +172,7 @@ public class WellOperationController : ControllerBase
[ProducesResponseType(typeof(IEnumerable<WellOperationCategoryDto>), StatusCodes.Status200OK)]
public IActionResult GetCategories(bool includeParents = true)
{
var result = wellOperationCategoryRepository.Get(includeParents);
var result = wellOperationCategoryRepository.Get(includeParents, false);
return Ok(result);
}