Esempio n. 1
0
        public Athlete RemoveAthleteGuid(int id)
        {
            var athlete = FindById(id);

            if (athlete == null)
            {
                return(null);
            }
            else
            {
                athlete.GUID = null;
                _athleteRepository.Update(athlete);
            }
            return(athlete);
        }
Esempio n. 2
0
        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"));
        }
Esempio n. 3
0
        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);
        }