Example #1
0
 public Meal GetById(int id)
 {
     return(db.Set <Meal>()
            .Where(m => m.MealId == id)
            .Include(m => m.MealProducts)
            .FirstOrDefault());
 }
Example #2
0
 public Day GetById(int id)
 {
     return(db.Set <Day>()
            .Where(d => d.DayId == id)
            .Include(d => d.DayMeals)
            .FirstOrDefault());
 }
Example #3
0
        public T Delete(int id)
        {
            var entity = context.Set <T>().Find(id);

            if (entity != null)
            {
                context.Set <T>().Remove(entity);
            }

            return(entity);
        }
Example #4
0
        public Product Add(Product newT)
        {
            db.Set <Product>().Add(newT);

            return(newT);
        }
Example #5
0
        public DayMeal Add(DayMeal newT)
        {
            db.Set <DayMeal>().Add(newT);

            return(newT);
        }