forked from slavaxom9k/PIBD-23_Fomichev_V.S._MagicCarpet
измнения в моделяз и котрактах хранилищ
This commit is contained in:
@@ -13,7 +13,7 @@ using System.Threading.Tasks;
|
||||
|
||||
namespace MagicCarpetDatabase.Implementations;
|
||||
|
||||
internal class PostStorageContract : IPostStorageContract
|
||||
public class PostStorageContract : IPostStorageContract
|
||||
{
|
||||
private readonly MagicCarpetDbContext _dbContext;
|
||||
private readonly Mapper _mapper;
|
||||
@@ -34,16 +34,11 @@ internal class PostStorageContract : IPostStorageContract
|
||||
_mapper = new Mapper(config);
|
||||
}
|
||||
|
||||
public List<PostDataModel> GetList(bool onlyActual = true)
|
||||
public List<PostDataModel> GetList()
|
||||
{
|
||||
try
|
||||
{
|
||||
var query = _dbContext.Posts.AsQueryable();
|
||||
if (onlyActual)
|
||||
{
|
||||
query = query.Where(x => x.IsActual);
|
||||
}
|
||||
return [.. query.Select(x => _mapper.Map<PostDataModel>(x))];
|
||||
return [.. _dbContext.Posts.Select(x => _mapper.Map<PostDataModel>(x))];
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user