Example #1
0
 public static IEnumerable <Mjesta> GetMjesta()
 {
     using (var ctx = new cslaEFmodelContainer())
     {
         return(ctx.Mjestas.ToList());
     }
 }
Example #2
0
 public static IEnumerable <Artikl> GetArtikl()
 {
     using (var ctx = new cslaEFmodelContainer())
     {
         return(ctx.Artikls.ToList());
     }
 }
Example #3
0
 public static IEnumerable <Fond> GetFond()
 {
     using (var ctx = new cslaEFmodelContainer())
     {
         return(ctx.Fonds.ToList());
     }
 }
Example #4
0
        public static Fond GetFondById(int Id)
        {
            using (var ctx = new cslaEFmodelContainer())
            {
                var getfond = ctx.Fonds.FirstOrDefault(c => c.Id == Id);
                if (getfond != null)
                {
                    return(getfond);
                }

                throw new InvalidOperationException("Greska");
            }
        }
Example #5
0
        public static Mjesta GetMjestbyId(int Id)
        {
            using (var ctx = new cslaEFmodelContainer())
            {
                var mjesta = ctx.Mjestas.SingleOrDefault(c => c.Id == Id);

                if (mjesta != null)
                {
                    return(mjesta);
                }

                throw new InvalidOperationException("Greska");
            }
        }
Example #6
0
        public static Artikl GetArtiklById(int Id)
        {
            using (var ctx = new cslaEFmodelContainer())
            {
                var artikl = ctx.Artikls.SingleOrDefault(c => c.Id == Id);

                if (artikl != null)
                {
                    return(artikl);
                }

                throw new InvalidOperationException("Greska");
            }
        }
Example #7
0
        public void seedMjesta()
        {
            using (var ctx = new cslaEFmodelContainer())
            {
                var mjestaJsonAll =
                    GetEmbeddedResourceAsString("DataAccessLayer.SeedData.mjesta.json");

                JArray  jsonValSpeakers = JArray.Parse(mjestaJsonAll) as JArray;
                dynamic mjs             = jsonValSpeakers;
                foreach (dynamic m in mjs)
                {
                    ctx.Mjestas.Add(new Mjesta
                    {
                        Id          = m.ID,
                        nazivMjesta = m.mjesta_grad
                    });
                    ctx.SaveChanges();
                }
            }
        }
Example #8
0
        public void seedFond()
        {
            using (var ctx = new cslaEFmodelContainer())
            {
                var FondJsonAll =
                    GetEmbeddedResourceAsString("DataAccessLayer.SeedData.Fond.json");

                JArray  jsonValSpeakers = JArray.Parse(FondJsonAll) as JArray;
                dynamic mjs             = jsonValSpeakers;
                foreach (dynamic m in mjs)
                {
                    ctx.Fonds.Add(new Fond
                    {
                        Id        = m.Id,
                        sifraFond = m.sifra_fond,
                        nazivFond = m.naziv_lijek,
                        Aktivan   = m.aktivan
                    });
                    ctx.SaveChanges();
                }
            }
        }