-1

I using automapper (last version).
I want to if a product create by logged in seller, a property will be changed in the select.

public class AutoMapperProfile : Profile
{
    public AutoMapperProfile()
    {
        CreateMap<Product, ProductDto>();
    }
}
var sellerId = 10; // Get from database
var products = _products
    .Select(x => new ProductDto
    {
        CanEdit = x.SellerId == sellerId ? true : false
    });

How can write above select by using automapper ?
Thanks a lot.

Progman
  • 14,690
  • 4
  • 32
  • 46
Jack Lee
  • 1
  • 2
  • Automapper was not built for mapping multiple models into one. If you still want to do it maybe you can check this answer https://stackoverflow.com/questions/21413273/automapper-convert-from-multiple-sources. – funatparties May 30 '22 at 22:10
  • https://stackoverflow.com/questions/4018491/automapper-is-there-a-built-in-way-to-map-a-condition-from-the-source-object-to – Rand Random May 30 '22 at 22:16

0 Answers0