using AutoMapper; using System.Linq; using Infrastructure.Entities; using Server.Dto.Request; using Server.Dto.Response; namespace Server.Mappers { public class SessionProfile : Profile { public SessionProfile() { CreateMap() .ForMember(dest => dest.Duration, opt => opt.MapFrom(src => src.Exercices.Sum(e => e.Template.Duration))) .ForMember(dest => dest.Exercices, opt => opt.MapFrom(src => src.Exercices)); CreateMap() .ForMember(dest => dest.Exercices, opt => opt.Ignore()); } } }