예제 #1
0
        public ArtistDetailDto MapToArtistDetailDto(Artist a)
        {
            var artist = new ArtistDetailDto()
            {
                Id                 = a.ArtistId,
                Name               = a.ArtistName,
                StatusId           = a.ArtistStatusId,
                CareerBeginDate    = a.CareerBeginDate,
                CareerEndDate      = a.CareerEndDate,
                Group              = a.ArtistGroup,
                UserId             = a.UserId,
                Verified           = a.Verified,
                HomeCity           = GetHomeCity(a),
                HomeCountryId      = a.HomeCountryId,
                HomeUsStateId      = a.HomeUsstateId,
                HomeUsCityId       = a.HomeUscityId,
                HomeUsZipCodeId    = a.HomeUszipCodeId,
                HomeWorldRegionId  = a.HomeWorldRegionId,
                HomeWorldCityId    = a.HomeWorldCityId,
                CurrentCountryId   = a.CurrentCountryId,
                CurrentUscityId    = a.CurrentUscityId,
                CurrentWorldCityId = a.CurrentWorldCityId,
                CreatedBy          = a.CreatedBy,
                CreatedDate        = a.CreatedDate,
                YearsActive        = ArtistCalculations.CalculateArtistYearsActive(a.CareerBeginDate, a.CareerEndDate),
            };

            return(artist);
        }
예제 #2
0
        // Artist
        public PagedListDto <ArtistForListDto> MapToArtistForListDto(PagedListData <Artist> pl)
        {
            var artists = pl.Select(a => new ArtistForListDto
            {
                Id             = a.ArtistId,
                Name           = a.ArtistName,
                ArtistStatusId = a.ArtistStatusId,
                YearsActive    = ArtistCalculations.CalculateArtistYearsActive(a.CareerBeginDate, a.CareerEndDate),
                ArtistGroup    = a.ArtistGroup,
                UserId         = a.UserId,
                Verified       = a.Verified,
                HomeCity       = GetHomeCity(a)
            }).ToList();

            var pldto = new PagedListDto <ArtistForListDto>(artists)
            {
                TotalItems   = pl.TotalItems,
                ItemsPerPage = pl.ItemsPerPage,
                CurrentPage  = pl.CurrentPage,
                TotalPages   = pl.TotalPages
            };;

            return(pldto);
        }