private void InitListViewModel(RaceItemsViewModel viewModel, RaceItems list) { foreach (var item in viewModel.Items) { InitBaseItemViewModel(item); item.RaceTypeName = GetRaceTypeName(item.RaceTypeId); item.SeasonTypeName = GetSeasonTypeName(item.SeasonTypeId); item.SeasonName = $"{item.SeasonTypeName}-{item.Year}"; } }
public ActionResult List(RaceFilterViewModel filterViewModel) { InitRaceFilterViewModel(ref filterViewModel, true); var filter = Mapper.Map <RaceFilter>(filterViewModel); RaceItems list = _raceRepository.GetRaceItems(UserContext.User.Id, UserContext.User.OrganizationId, filter); RaceItemsViewModel viewModel = Mapper.Map <RaceItemsViewModel>(list); viewModel.Filter = filterViewModel; InitListViewModel(viewModel, list); return(View(Mvc.View.Race.List, viewModel)); }