private GroupWithTime ConvertModelToDto(Group group) { return(new GroupWithTime { Groupname = @group.Groupname, Startnumber = @group.StartNumber, Participant1Time = @group.Participant1?.FinishTime ?? DateTime.MinValue, Participant2Time = @group.Participant2?.FinishTime ?? DateTime.MinValue, FinishTime = @group?.FinishTime ?? DateTime.MinValue, }); }
private GroupResult ConvertGroupModelToGroupResultDto(Group raceGroup, TimeSpan bestTime) { return(new GroupResult { GroupId = raceGroup.GroupId, Selected = true, FinishTime = raceGroup.FinishTime.Value, Groupname = raceGroup.Groupname, GroupClass = raceGroup.Class, Startnumber = raceGroup.StartNumber, Participant1Name = $"{raceGroup.Participant1?.Firstname} {raceGroup.Participant1?.Lastname}", Participant1Category = $"{raceGroup.Participant1?.Category}", Participant2Name = $"{raceGroup.Participant2?.Firstname} {raceGroup.Participant2?.Lastname}", Participant2Category = $"{raceGroup.Participant2?.Category}", TimeTaken = raceGroup.TimeTaken.Value.ToString(@"c"), TimeDiff = (raceGroup.TimeTaken - bestTime).Value.ToString(@"c") }); }