Beispiel #1
0
        //Einen Benutzer löschen
        public void DeleteClient(String username)
        {
            DatabaseContextInstance cdl = DatabaseContext.GetContext();

            cdl.Clients.Remove(cdl.Clients.Find(username));
            cdl.SaveChanges();
        }
        //Teilnehmer anhand der ID loeschen
        public void DeleteCompetitor(Guid CompetitorID)
        {
            DatabaseContextInstance cdl = DatabaseContext.GetContext();

            cdl.Competitors.Remove(cdl.Competitors.Find(CompetitorID));
            cdl.SaveChanges();
        }
Beispiel #3
0
        //Benutzer erstellen
        public void CreateClient(Client newClient)
        {
            DatabaseContextInstance cdl = DatabaseContext.GetContext();

            cdl.Clients.Add(newClient);
            cdl.SaveChanges();
        }
        //Teilnehmer anhand der ID finden
        public Competitor FindCompetitor(Guid CompetitorID)
        {
            DatabaseContextInstance cdl = DatabaseContext.GetContext();
            Competitor c = cdl.Competitors.Find(CompetitorID);

            return(c);
        }
        //Teilnehmer hinzufuegen
        public void CreateCompetitor(Competitor participant)
        {
            DatabaseContextInstance cdl = DatabaseContext.GetContext();

            cdl.Competitors.Add(participant);
            cdl.SaveChanges();
        }
 //Alle Teilnehmer loeschen
 public void DeleteAllCompetitors()
 {
     using (DatabaseContextInstance cdl = DatabaseContext.GetContext())
     {
         cdl.Competitors.RemoveRange(cdl.Competitors);
         cdl.SaveChanges();
     }
 }
Beispiel #7
0
        //Benutzer aktualisieren
        public void UpdateClient(String username, Client newClient)
        {
            DatabaseContextInstance cdl = DatabaseContext.GetContext();
            Client oldClient            = cdl.Clients.Find(username);

            oldClient.Name     = newClient.Name;
            oldClient.Surname  = newClient.Surname;
            oldClient.Gender   = newClient.Gender;
            oldClient.EMail    = newClient.EMail;
            oldClient.Password = newClient.Password;
            cdl.SaveChanges();
        }
        //Teilnehmer anhand der ID updaten
        public void UpdateCompetitor(Guid compID, Competitor newParticipant)
        {
            DatabaseContextInstance cdl = DatabaseContext.GetContext();
            Competitor oldParticipant   = cdl.Competitors.Find(compID);

            oldParticipant.Name       = newParticipant.Name;
            oldParticipant.Surname    = newParticipant.Surname;
            oldParticipant.Gender     = newParticipant.Gender;
            oldParticipant.SkillLevel = newParticipant.SkillLevel;
            oldParticipant.Visibility = newParticipant.Visibility;
            cdl.SaveChanges();
        }
        //alle Teilnehmer laden
        public IDictionary <Guid, Competitor> LoadCompetitors()
        {
            IDictionary <Guid, Competitor> competitors = new SortedList <Guid, Competitor>();

            using (DatabaseContextInstance db = DatabaseContext.GetContext())
            {
                IEnumerable <Competitor> competitors1 = db.Competitors;
                foreach (Competitor c in competitors1)
                {
                    competitors.Add(c.CompetitorID, c);
                }
            }

            return(competitors);
        }
Beispiel #10
0
        //Einen Benutzer finden und zurückgeben
        public Client FindClient(String username)
        {
            DatabaseContextInstance cdl = DatabaseContext.GetContext();

            return(cdl.Clients.Find(username));
        }