Пример #1
0
        public void InsertOgloszenieKategoria(int kategoriaId)
        {
            var lastId = _db.Ogloszenia.Max(p => p.Id).ToString();

            Ogloszenie_Kategoria oglkat = new Ogloszenie_Kategoria()
            {
                KategoriaId  = kategoriaId,
                OgloszenieId = Convert.ToInt32(lastId)
            };

            _db.Ogloszenie_Kategoria.Add(oglkat);
        }
Пример #2
0
 private void SeedOgloszenie_Kategoria(OglContext context)
 {
     for (int i = 1; i <= 10; i++)
     {
         Ogloszenie_Kategoria okat = new Ogloszenie_Kategoria()
         {
             Id           = i,
             OgloszenieId = i / +1,
             KategoriaId  = i / 2 + 1
         };
         context.Set <Ogloszenie_Kategoria>().AddOrUpdate(okat);
     }
 }
Пример #3
0
 private void SeedOgloszenie_Kategoria(OglContext context)
 {
     for (int i = 1; i < 10; i++)
     {
         var okat = new Ogloszenie_Kategoria()
         {
             Id           = i,
             OgloszenieId = i / 2 + 1,
             KategoriaId  = i / 2 + 2
         };
         context.Set <Ogloszenie_Kategoria>().AddOrUpdate(okat);
     }
     context.SaveChanges();
 }