Пример #1
0
 public bool CompetitorExists(Competitors competitor)
 {
     if (Comp.ToList().Contains(competitor))
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #2
0
 public CompetitorsWithSubgroups(Competitors competitors, int subgroup)
 {
     Id       = competitors.Id;
     Subgroup = subgroup;
     Name     = competitors.Name;
     Surname  = competitors.Surname;
     Year     = competitors.Year;
     Gender   = competitors.Gender;
     City     = competitors.City;
     Country  = competitors.Country;
     CoachId  = competitors.CoachId;
 }
Пример #3
0
        public bool ReplaceExisting(Competitors competitor)
        {
            List <Competitors> removedOld = RemoveCompetitorFromCompetitors(competitor.Id);

            if (removedOld != null)
            {
                AddCompetitorToCompetitors(competitor);
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #4
0
        public List <Competitors> RemoveCompetitorFromCompetitors(int id)
        {
            Competitors competitor = GetCompetitor(id);

            if (competitor != null)
            {
                Comp.Remove(competitor);
                SaveChanges();
                return(Comp.ToList());
            }
            else
            {
                return(null);
            }
        }
Пример #5
0
        public bool ChangeCompetitorValues(Competitors competitor)
        {
            if (competitor != null)
            {
                Competitors original = Comp.Where(c => c.Id == competitor.Id).ToList()[0];

                if (!(original.Name.Equals(competitor.Name)) && !(competitor.Name.Equals(string.Empty)))
                {
                    original.Name = competitor.Name;
                }
                if (!(original.Surname.Equals(competitor.Surname)) && !(competitor.Surname.Equals(string.Empty)))
                {
                    original.Surname = competitor.Surname;
                }
                if (!(original.Year.Equals(competitor.Year)) && !(competitor.Year.Equals(string.Empty)))
                {
                    original.Year = competitor.Year;
                }
                if (!(original.City.Equals(competitor.City)) && !(competitor.City.Equals(string.Empty)))
                {
                    original.City = competitor.City;
                }
                if (!(original.Country.Equals(competitor.Country)) && !(competitor.Country.Equals(string.Empty)))
                {
                    original.Country = competitor.Country;
                }
                if (!(original.Gender.Equals(competitor.Gender)) && !(competitor.Gender.Equals(string.Empty)))
                {
                    original.Gender = competitor.Gender;
                }

                ReplaceExisting(original);
            }
            else
            {
                return(false);
            }
            return(true);
        }
Пример #6
0
 public List <Competitors> AddCompetitorToCompetitors(Competitors competitor)
 {
     Comp.Add(competitor);
     SaveChanges();
     return(Comp.ToList());
 }
Пример #7
0
        public override bool Equals(object c)
        {
            Competitors competitor = (Competitors)c;

            return(Name.Equals(competitor.Name) && Surname.Equals(competitor.Surname) && Year.Equals(competitor.Year));
        }