public static DomainCar FromRepoCarToDomainCar(this RepoCar item) { if (item == null) { return(null); } return(new DomainCar { Id = item.Id, Name = item.Name, CarBrand = item.CarBrand, Price = item.Price, ExtencionName = item.ExtencionName, Info = item.Info, image = item.image, OwnerId = item.OwnerId, BrandId = item.BrandId, // BuyCars = item.BuyCars.Select(x => x.FromRepoBuyCarToDomainBuyCar()).ToList(), }); }
public static Car FromRepoCarToCar(this RepoCar item) { Mapper.Initialize(cfg => cfg.CreateMap <RepoCar, Car>() .ForMember(x => x.BuyCars, _ => _.Ignore())); return(Mapper.Map <RepoCar, Car>(item)); }