Пример #1
0
        public List <KreiraniObrok> GetMealsForUserById(int idKorisnik)
        {
            INamirnica repo = RepoFactory.GetNamirnicaRepo();

            ds = SqlHelper.ExecuteDataset(cs, "GetMealsForUser", idKorisnik);
            List <KreiraniObrok> kolekcija = new List <KreiraniObrok>();

            foreach (DataRow row in ds.Tables[0].Rows)
            {
                KreiraniObrok o = new KreiraniObrok();
                o.IDObrok        = (int)row["IDObrok"];
                o.NazivObroka    = (string)row["NazivObroka"];
                o.DatumIzrade    = (DateTime)row["DatumIzrade"];
                o.ListaNamirnica = repo.GetIngredientForMeal(o.IDObrok); //????
                kolekcija.Add(o);
            }

            return(kolekcija);
        }
Пример #2
0
        public List <KreiraniObrok> GetCreatedMealListByDate(string datum)
        {
            INamirnica           repo      = RepoFactory.GetNamirnicaRepo();
            List <KreiraniObrok> kolekcija = new List <KreiraniObrok>();

            var meals = FilterMealByDate(datum);

            foreach (var item in meals)
            {
                KreiraniObrok obrok = new KreiraniObrok();
                obrok.IDObrok        = item.IDObrok;
                obrok.DatumIzrade    = item.DatumIzrade;
                obrok.NazivObroka    = item.NazivObroka;
                obrok.ListaNamirnica = repo.GetIngredientForMeal(item.IDObrok);
                kolekcija.Add(obrok);
            }

            return(kolekcija);
        }
Пример #3
0
        public bool ContainsIngredient(string name)
        {
            INamirnica repo = RepoFactory.GetNamirnicaRepo();

            List <NamirniceModel> kolekcijaNamirnica = repo.getIngredients("sve");

            bool result = false;

            foreach (var item in kolekcijaNamirnica)
            {
                if (item.NazivNamirnice.ToLower() == name.ToLower())
                {
                    result = true;
                    break;
                }
            }

            return(result);
        }