Example #1
0
        /**
         * // Update
         * public static void DemoAUpdate()
         * {
         *  Debug.Print("--- DemoAUpdate ---");
         *  // Pokemon ändert Attribute
         *  Data.Pokemon klasseA1 = Data.Pokemon.LesenID(1);
         *  klasseA1.TextAttribut = "Artikel 1 nach Update";
         *  klasseA1.KlasseBId = 2;  // Wichtig: Fremdschlüssel muss über Id aktualisiert werden!
         *  klasseA1.Aktualisieren();
         * }
         * // Delete
         * public static void DemoADelete()
         * {
         *  Debug.Print("--- DemoADelete ---");
         *  Data.Pokemon.LesenID(1).Loeschen();
         *  Debug.Print("Artikel mit Id 1 gelöscht");
         * }
         #endregion
         **/
        #region Typ
        // Create
        public static void Create_Typ(String type)
        {
            Debug.Print("--- Pokemon Create ---");
            Data.Typ typ = new Data.Typ {
                Type = type, ID_Typ = Get_All_Types().Count + 1
            };
            Int64 typID = typ.Erstellen();

            Debug.Print("Typ erstellt mit Id:" + typID);
        }
Example #2
0
 public Int64 Erstellen(List <Int64> typen)
 {
     using (var context = new Context())
     {
         foreach (Int64 id in typen)
         {
             Typ typ = context.Typs.FirstOrDefault(t => t.ID_Typ == id);
             Typs.Add(typ);
         }
         context.Pokemons.Add(this);
         //TODO Check ob mit null möglich, sonst throw Ex
         //if (FremdschluesselListe_Typ != null) context.Typ.Attach(FremdschluesselListe_Typ);
         context.SaveChanges();
         return(this.Nr_Pokemon);
     }
 }