Я хочу получить данные из базы данных и вернуть их почтальону. В режиме отладки я вижу, что есть некоторые данные, но по некоторым причинам я не вижу их в почтальоне.


public async Task<ProductComparsionVM> GetProductComparsionByListId(int listId)
{
var comparsionList = _dbContext.ProductsComparsion.Include(z => z.ProductsToCompare).FirstOrDefault(z => z.Id == listId);
if (comparsionList == null)
return null;
var category = _dbContext.Categories.FirstOrDefault(z => z.Id == comparsionList.CategoryId);
var tmp = new ProductComparsionVM
{
ProductsToCompare2 = comparsionList.ProductsToCompare.ToList()
};
return tmp;
}
public class ProductComparsionVM
{
public int CategoryId { get; set; }
public string CategoryName { get; set; }
public int ListId { get; set; }
public int ProductId { get; set; }
public List<int> ProductsToCompare { get; set; }
public List<ProductToCompare> ProductsToCompare2 { get; set; }
}
Есть другие поля, которые я могу получить в почтальоне, если комментарий ProductsToCompare2 = ..
Редактировать 1
[HttpPost]
public async Task<IActionResult> GetProductComparsionByListId([FromBody] ProductComparsionVM comparsion)
{
return Json(await _productRepo.GetProductComparsionByListId(comparsion.ListId));
}