public async Task <CocktailResponse> AddAsync(Domain.Models.Cocktail cocktail, List <Ingredient> ingredients) { try { await _cocktailRepository.AddAsync(cocktail, ingredients); await _unitOfWork.CompleteAsync(); return(new CocktailResponse(cocktail)); } catch (Exception ex) { return(new CocktailResponse($"An error occurred when saving the cocktail: {ex.Message}")); } }
public async Task <CocktailResponse> AddAsync(Cocktail cocktail, List <Ingredients> ingredients) { try { await _cocktailRepository.AddAsync(cocktail, ingredients); await _unitOfWork.CompleteAsync(); return(new CocktailResponse(cocktail)); } catch (Exception ex) { // Do some logging stuff return(new CocktailResponse($"An error occurred when saving the category: {ex.Message}")); } }