public IActionResult CreateAthlete(int?testId, int?athleteId) { AthleteModel model = new AthleteModel(); Test test = new Test(); AthleteTestMapping athleteTestMapping = new AthleteTestMapping(); string domainName = _configuration["DomainName"].ToSafeString(); if (!string.IsNullOrEmpty(domainName)) { if (testId.HasValue && athleteId.ToSafeInt() == 0) { model.TestId = testId.ToSafeInt(); model.userList = BALUser.GetUserListByRoleId((int)Enums.UserRole.Athlete, domainName); test = BALUser.GetTestTypeByTestId(testId.ToSafeInt(), domainName); model.TestName = test.TestName.ToSafeString() + " " + test.TestDate.ToString("yyyy/MM/dd"); model.IsEditMode = false; } else { model.TestId = testId.ToSafeInt(); model.userList = BALUser.GetUserListByRoleId((int)Enums.UserRole.Athlete, domainName); test = BALUser.GetTestTypeByTestId(testId.ToSafeInt(), domainName); model.TestName = test.TestName.ToSafeString() + " " + test.TestDate.ToString("yyyy/MM/dd"); athleteTestMapping = BALUser.GetAthlete(athleteId.ToSafeInt(), domainName); if (athleteTestMapping != null) { model.AthleteId = athleteTestMapping.AthleteId.ToSafeInt(); model.Distance = athleteTestMapping.Distance; model.IsEditMode = true; model.MapId = athleteTestMapping.MapId.ToSafeInt(); } } } return(PartialView("~/Views/Home/AddAthlete.cshtml", model)); }