public static PickViewModel FromPick(Pick pick) { var scheduleModel = ScheduleViewModel.FromSchedule(pick.Schedule); return new PickViewModel() { Id = pick.Id, User = UserListViewModel.FromUser(pick.User), Schedule = scheduleModel, PickHomeTeam = pick.PickHomeTeam, CombinedScore = pick.CombinedScore, CanPick = scheduleModel.IsPickable(), IsPick = true // coming from a Pick entry => must be a pick }; }
public static PickViewModel FromPick(Pick pick) { var scheduleModel = ScheduleViewModel.FromSchedule(pick.Schedule); return new PickViewModel() { Id = pick.Id, User = (pick.UserId == Pick.MASTER_PICKS_USER_ID ? new UserListViewModel { Id = pick.UserId } : UserListViewModel.FromUser(pick.User)), Schedule = scheduleModel, PickHomeTeam = pick.PickHomeTeam, CombinedScore = pick.CombinedScore, GameDateDisplay = scheduleModel.Date.ToString("dddd, MMMM d"), GameTimeDisplay = scheduleModel.Date.ToString("t") + " EST", CanPick = scheduleModel.IsPickable, IsPick = true // coming from a Pick entry => must be a pick }; }