示例#1
0
        public bool DeleteFoodDrinkByID(int foodID)
        {
            FoodDrink fDrink = dbContext.FoodDrinks.Where(f => f.FoodDrinkID == foodID).FirstOrDefault();

            if (fDrink != null && foodID >= 0)
            {
                fDrink.IsAvailable = false;
                dbContext.SaveChanges();
                return(true);
            }
            return(false);
        }
示例#2
0
 public bool AddFoodDrink(FoodDrink foodDrink)
 {
     try
     {
         if (foodDrink != null)
         {
             dbContext.FoodDrinks.Add(foodDrink);
             dbContext.SaveChanges();
             return(true);
         }
         return(false);
     }
     catch (Exception e)
     {
         return(false);
     }
 }
示例#3
0
 public bool EditFoodDrink(FoodDrink food)
 {
     try
     {
         if (food != null)
         {
             FoodDrink fDrink = dbContext.FoodDrinks.Where(f => f.FoodDrinkID == food.FoodDrinkID).FirstOrDefault();
             if (fDrink == null)
             {
                 return(false);
             }
             fDrink.ImageURL      = food.ImageURL;
             fDrink.FoodDrinkName = food.FoodDrinkName;
             fDrink.Description   = food.Description;
             dbContext.SaveChanges();
             return(true);
         }
         return(false);
     }
     catch (Exception e)
     {
         return(false);
     }
 }