mirror of
https://github.com/chsakell/aspnet-core-signalr-angular.git
synced 2025-12-22 17:27:48 +00:00
20 lines
686 B
C#
20 lines
686 B
C#
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using AutoMapper;
|
|
using LiveGameFeed.Models;
|
|
|
|
namespace LiveGameFeed.Core.Mappings
|
|
{
|
|
public class DomainToViewModelMappingProfile : Profile
|
|
{
|
|
protected override void Configure()
|
|
{
|
|
Mapper.CreateMap<Match, MatchViewModel>()
|
|
.ForMember(vm => vm.Type, map => map.MapFrom(m => m.Type.ToString()))
|
|
.ForMember(vm => vm.Feeds, map => map.MapFrom(m =>
|
|
Mapper.Map<ICollection<Feed>, ICollection<FeedViewModel>>(m.Feeds.OrderByDescending(f => f.Id).ToList())));
|
|
Mapper.CreateMap<Feed, FeedViewModel>();
|
|
}
|
|
}
|
|
}
|