Ejemplo n.º 1
0
        internal void RemoveFoodSpecialDate(Guid?foodid, specialdate sd)
        {
            food food = db.food.Find(foodid);

            food.specialdate.Remove(sd);
            db.SaveChanges();
        }
Ejemplo n.º 2
0
        public void UpdatePosition(food food)
        {
            int  nextPosition = food.position.Value;
            food curFood      = food;

            while (db.food.Any(x => x.position == nextPosition && x.categoryid == curFood.categoryid && x.id != curFood.id))
            {
                IEnumerable <food> foods = db.food.Where(x => x.position == nextPosition && x.categoryid == curFood.categoryid && x.id != curFood.id);
                foreach (var item in foods)
                {
                    item.position++;
                }
                db.SaveChanges();
                nextPosition++;
                curFood = db.food.FirstOrDefault(x => x.position == nextPosition && x.categoryid == curFood.categoryid);
            }
            ;
        }