Example #1
0
 public AutoMapperProfile()
 {
     CreateMap <UserCreateEditModel, User>();
     CreateMap <User, UserModel>();
     CreateMap <FtpCredential, FtpCredentialGridVm>();
     CreateMap <FtpCredential, FtpCredentialCreateEditModel>().ReverseMap();
     CreateMap <MasterAccount, MasterAccountVm>().ReverseMap();
     CreateMap <MasterAccount, MasterAccountGridVm>()
     .ForMember(a => a.CreatedBy, opt => opt.MapFrom(src => src.CreatedBy.Email))
     .ForMember(a => a.UpdatedBy, opt => opt.MapFrom(src => src.UpdatedBy.Email));
     CreateMap <User, UserGridViewModel>()
     .ForMember(x => x.Roles, opt => opt.MapFrom(y => y.Roles.Select(r => r.Name)));
     CreateMap <TradeAccount, TradeAccountInfoGridViewModel>();
     CreateMap <TradingPermission, TradingPermissionsGridVM>();
     CreateMap <TradeAccountNote, TradeAccountNoteVm>()
     .ForMember(acc => acc.CreatedBy, opt => opt.MapFrom(src => src.CreatedBy.Email));
     CreateMap <TradeAccount, AccountInfoGridVM>()
     .ForMember(acc => acc.MasterAccount, opt => opt.MapFrom(src => TradeUtils.ResolveMasterAccountName(src.MasterAccount)));
     CreateMap <TradeAccountNoteCreateEditModel, TradeAccountNote>();
     CreateMap <TradeAccountRankEditModel, TradeAccount>();
     CreateMap <MasterAccount, MasterAccountCreateEditModel>().ReverseMap();
     CreateMap <TradeAccount, TradeAccountModel>();
     CreateMap <TradeNav, PortfolioVm>();
     CreateMap <TradeSytossOpenPosition, OpenPositionVm>();
     CreateMap <TradesExe, TradesExeInformationVm>();
 }
 public IEnumerable <IdNameModel> GetIdNames()
 {
     return(_masterAccountRepository.GetAll().Select(acc => new IdNameModel
     {
         Id = acc.Id,
         Name = TradeUtils.ResolveMasterAccountName(acc)
     }));
 }