Пример #1
0
        /// <summary>
        /// Method to add a recipe to the database if valid
        /// </summary>
        /// <param name="name">The name of the recipe</param>
        public async Task AddRecipeAsync(TextBox name)
        {
            var isValid = ValidationObject.ValidateRecipeName(name);

            if (isValid)
            {
                var recipeToAdd = new RecipeDTO()
                {
                    Name = name.Text
                };
                var added = await BusinessObject.AddRecipeAsync(recipeToAdd);


                if (added)
                {
                    ShowMessage($"Recipe {recipeToAdd.Name} Added");
                    name.Clear();
                }
                else
                {
                    ShowMessage($"Recipe {recipeToAdd.Name} Not Added");
                }
            }
        }