예제 #1
0
        private void AddToFavorites(RecipeDto recipe)
        {
            if (_loggedUser != null && !_loggedUser.Favourites.Any(x => x.Id == recipe.Id))
            {
                var choice = _getDataFromUser.GetData("Do you want to add this recipe to favorites? Y/N");

                if (choice.ToUpper() == "Y")
                {
                    var success = (_recipesService.AddToFavorites(_loggedUser, recipe))? new object() : null;
                    ShowResult(success);
                    UpdateLoggedUser();
                }
                ;
            }
        }
예제 #2
0
        public async Task <IActionResult> AddToFavorites(int id)
        {
            await _recipesService.AddToFavorites(id);

            return(Ok());
        }