예제 #1
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);
        }