public Athlete RemoveAthleteGuid(int id) { var athlete = FindById(id); if (athlete == null) { return(null); } else { athlete.GUID = null; _athleteRepository.Update(athlete); } return(athlete); }
public ActionResult Update(Athlete athlete) { if (ModelState.IsValid) { if (_athRepo.Update(athlete)) { TempData["Success"] = "Updated succesfully"; return(RedirectToAction("List")); } } TempData["Error"] = "Error updating an athlete!"; return(RedirectToAction("List")); }
public int SaveAthlete(Athlete athlete) { if (athlete is null) { return(0); } var currentAthlete = _athleteRepository.GetByUrl(athlete.Url); if (currentAthlete is null) { athlete.Id = _athleteRepository.Insert(athlete); } else { athlete.Id = currentAthlete.Id; _athleteRepository.Update(athlete); } return(athlete.Id); }