Пример #1
0
        //Update
        public bool UpdateExistingContent(string originalMealName, MenuContent newContent)
        {
            //Find the content
            MenuContent oldContent = GetContentByMealName(originalMealName);

            //update the content
            if (oldContent != null)
            {
                oldContent.MealName        = newContent.MealName;
                oldContent.DescriptionType = newContent.DescriptionType;
                oldContent.Ingredientlist  = newContent.Ingredientlist;
                oldContent.MealPrice       = newContent.MealPrice;
                oldContent.TypeOfmeal      = newContent.TypeOfmeal;

                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
        //Delete
        public bool RemoveContentFromList(string mealname)
        {
            MenuContent content = GetContentByMealName(mealname);

            if (content == null)
            {
                return(false);
            }

            int initialCount = _listOfContent.Count;

            _listOfContent.Remove(content);

            if (initialCount > _listOfContent.Count)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #3
0
 //Create
 public void AddContentToList(MenuContent content)
 {
     _listOfContent.Add(content);
 }