Exemplo n.º 1
0
        private int getAverage(IceCream iceCream)
        {
            var temp = 0;

            if (iceCream.Recommendations != null)
            {
                foreach (var Rec in iceCream.Recommendations)
                {
                    temp += Rec.Rank;
                }
                temp = temp / iceCream.Recommendations.Count();
            }
            return(temp);
        }
Exemplo n.º 2
0
        public bool insertIcecream(IceCream iceCream)
        {
            var document = _dbContext._database.GetCollection <IceCream>("iceCreams");
            var query    = Query.And(Query.EQ("Name", iceCream.Name), Query.EQ("Store", iceCream.Store));

            var count = document.FindAs <IceCream>(query).Count();

            if (count == 0)
            {
                document.Insert(iceCream);

                return(true);
            }
            return(false);
        }