public IActionResult CreateNewAthlete(AthleteModel model) { int result = 0; string domainName = _configuration["DomainName"].ToSafeString(); if (!string.IsNullOrEmpty(domainName)) { AthleteTestMapping athleteTest = new AthleteTestMapping(); athleteTest.AthleteTestId = model.TestId.ToSafeInt(); athleteTest.AthleteId = model.AthleteId.ToSafeInt(); athleteTest.Distance = model.Distance; if (model.IsEditMode) { result = BALUser.AddAthlete(athleteTest, domainName, 1, model.MapId.ToSafeInt()); } else { result = BALUser.AddAthlete(athleteTest, domainName, 0, model.MapId.ToSafeInt()); } switch (result) { case -1: TempData["message"] = "Athlete already exists in this test."; TempData["IsSuccess"] = 0; break; case 0: TempData["message"] = "Something went wrong."; TempData["IsSuccess"] = 0; break; case 1: TempData["message"] = "Record successfully inserted."; TempData["IsSuccess"] = 1; break; case 2: TempData["message"] = "Record successfully updated."; TempData["IsSuccess"] = 1; break; } } return(RedirectToAction("AthleteList", new { id = model.TestId })); }