示例#1
0
        internal static PlayDataDetailsViewModel ToDetailsViewModel(PlayData playData)
        {
            var pdVM = new PlayDataDetailsViewModel
            {
                ID              = playData.ID,
                GameID          = playData.GameID,
                GameTitle       = playData.Game.Title,
                PlayerName      = playData.Hoarder.Name,
                Status          = playData.Status,
                Priority        = playData.Priority.Name,
                Rating          = playData.Rating == null? "" : playData.Rating.ToString(),
                OwnershipStatus = playData.OwnershipStatus.Name,
                TotalPlaytime   = PlaytimeHelper.GetLongPlaytimeString(playData.TotalPlaytime),
                FirstPlayed     = playData.FirstPlayed == null? "Unknown" : ((DateTime)playData.FirstPlayed).ToString(EntityConstants.DateFormatString),
                LastPlayed      = playData.LastPlayed == null? "Unknown" : ((DateTime)playData.LastPlayed).ToString(EntityConstants.DateFormatString),
                Notes           = playData.Notes
            };

            if (playData.Playthroughs != null && playData.Playthroughs.Count != 0)
            {
                foreach (var pt in playData.Playthroughs)
                {
                    var ptVM = PlaythroughMapper.ToPlayDataDetailsViewModel(pt);

                    pdVM.Playthroughs.Add(ptVM);
                }
            }

            return(pdVM);
        }
示例#2
0
        internal static GamePlayDataDetailsViewModel ToGameDetailsViewModel(PlayData playData)
        {
            var pdVM = new GamePlayDataDetailsViewModel
            {
                ID            = playData.ID,
                PlayerName    = playData.Hoarder.Name,
                Status        = playData.Status,
                Priority      = playData.Priority.Name,
                Rating        = playData.Rating == null ? "" : playData.Rating.ToString(),
                TotalPlaytime = PlaytimeHelper.GetLongPlaytimeString(playData.TotalPlaytime),
                Notes         = playData.Notes
            };

            if (playData.Playthroughs != null && playData.Playthroughs.Count != 0)
            {
                foreach (var pt in playData.Playthroughs)
                {
                    var ptVM = PlaythroughMapper.ToGameDetailsViewModel(pt);

                    pdVM.Playthroughs.Add(ptVM);
                }
            }

            return(pdVM);
        }