26 lines
698 B
C#
26 lines
698 B
C#
using API.Dtos;
|
|
using AutoMapper;
|
|
using Core.Entities.OrderAggregate;
|
|
|
|
namespace API.Helpers
|
|
{
|
|
public class OrderItemUrlResolver : IValueResolver<OrderItem, OrderItemDto, string>
|
|
{
|
|
private readonly IConfiguration _config;
|
|
|
|
public OrderItemUrlResolver(IConfiguration config)
|
|
{
|
|
_config = config;
|
|
}
|
|
|
|
public string Resolve(OrderItem source, OrderItemDto destination, string destMember, ResolutionContext context)
|
|
{
|
|
if(!string.IsNullOrEmpty(source.ItemOrdered.PictureUrl))
|
|
{
|
|
return _config["ApiUrl"] + source.ItemOrdered.PictureUrl;
|
|
}
|
|
|
|
return null;
|
|
}
|
|
}
|
|
} |