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(); } ; } }
public async Task <IActionResult> AddToFavorites(int id) { await _recipesService.AddToFavorites(id); return(Ok()); }