Show episode count for each season
This commit is contained in:
@@ -29,7 +29,7 @@ namespace EstusShots.Gtk
|
||||
new DataColumnText(nameof(Enemy.Seasons))
|
||||
{
|
||||
Title = "Game",
|
||||
DisplayConverter = seasons => string.Join(", ", ((IEnumerable<Season>) seasons).Select(x => x.Game))
|
||||
DisplayConverter = seasons => ((IEnumerable<Season>) seasons)?.Select(x => x.Game).StringJoin(", ")
|
||||
}
|
||||
};
|
||||
_enemiesControl = new BindableListControl<Enemy>(columns, nameof(Enemy.EnemyId), _enemiesTreeView);
|
||||
|
||||
@@ -116,7 +116,8 @@ namespace EstusShots.Gtk
|
||||
new DataColumnText(nameof(Season.End))
|
||||
{
|
||||
DisplayConverter = date => (date as DateTime?)?.ToString("dd.MM.yyyy") ?? "Ongoing"
|
||||
}
|
||||
},
|
||||
new DataColumnText(nameof(Season.EpisodeCount)) {Title = "Episode Count"}
|
||||
};
|
||||
SeasonsControl = new BindableListControl<Season>(columns, nameof(Season.SeasonId), SeasonsView);
|
||||
SeasonsControl.SelectionChanged += SeasonsControlSelectionChanged;
|
||||
|
||||
@@ -8,7 +8,8 @@ namespace EstusShots.Server.Mapping
|
||||
{
|
||||
public Profiles()
|
||||
{
|
||||
CreateMap<Season, Shared.Dto.Season>();
|
||||
CreateMap<Season, Shared.Dto.Season>()
|
||||
.ForMember(x => x.EpisodeCount, y => y.MapFrom(z => z.Episodes.Count));
|
||||
CreateMap<Shared.Dto.Season, Season>();
|
||||
|
||||
CreateMap<Episode, Shared.Dto.Episode>();
|
||||
|
||||
@@ -27,7 +27,9 @@ namespace EstusShots.Server.Services
|
||||
|
||||
public async Task<ApiResponse<GetSeasonsResponse>> GetSeasons(GetSeasonsParameter parameter)
|
||||
{
|
||||
var seasons = await _context.Seasons.ToListAsync();
|
||||
var seasons = await _context.Seasons
|
||||
.Include(season => season.Episodes)
|
||||
.ToListAsync();
|
||||
var dtos = _mapper.Map<List<Dto.Season>>(seasons);
|
||||
return new ApiResponse<GetSeasonsResponse>(new GetSeasonsResponse(dtos));
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ namespace EstusShots.Shared.Dto
|
||||
|
||||
public DateTime? End { get; set; }
|
||||
|
||||
public int EpisodeCount { get; set; }
|
||||
|
||||
public string DisplayName => $"S{Number:D2} {Game}";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user