Exemplo n.º 1
0
        public async Task SaveArtikels(IList <Models.Artikel> artikels)
        {
            List <DAL.Artikel> artikelsForDB = new List <DAL.Artikel>();

            foreach (var artikel in artikels)
            {
                var artikelDAL = new DAL.Artikel
                {
                    ArtikelCode   = artikel.ArtikelCode,
                    Color         = artikel.Color,
                    ColorCode     = artikel.ColorCode,
                    DeliveredIn   = artikel.DeliveredIn,
                    Description   = artikel.Description,
                    DiscountPrice = artikel.DiscountPrice,
                    Key           = artikel.Key,
                    Price         = artikel.Price,
                    Q1            = artikel.Q1,
                    Size          = artikel.Size
                };

                artikelsForDB.Add(artikelDAL);
            }

            await artikelStoreDB.Artikels.AddRangeAsync(artikelsForDB);

            await artikelStoreDB.SaveChangesAsync();
        }
Exemplo n.º 2
0
 public static List <DAL.Bewegung> LesenFremdschluesselGleich(DAL.Artikel suchschluessel)
 {
     using (var context = new DAL.Context())
     {
         return((from record in context.Bewegung.Include("Artikel") where record.Artikel.ArtikelId == suchschluessel.ArtikelId select record).ToList());
     }
 }
Exemplo n.º 3
0
 public static void Loeschen(DAL.Artikel artikel)
 {
     using (var context = new DAL.Context())
     {
         context.Artikel.Remove(artikel);
         context.SaveChanges();
     }
 }
Exemplo n.º 4
0
 public static void Aktualisieren(DAL.Artikel artikel)
 {
     using (var context = new DAL.Context())
     {
         //TODO null Checks?
         context.Entry(artikel).State = System.Data.Entity.EntityState.Modified;
         context.SaveChanges();
     }
 }
Exemplo n.º 5
0
 public static Int64 Erstellen(DAL.Artikel artikel)
 {
     if (artikel.Bezeichnung == null || artikel.Bezeichnung == "")
     {
         artikel.Bezeichnung = "leer";
     }
     using (var context = new DAL.Context())
     {
         context.Artikel.Add(artikel);
         context.SaveChanges();
         return(artikel.ArtikelId);
     }
 }