public static async Task <List <Ingredient> > GetIngredientsAsync(int recipeId) { List <Ingredient> ingredientList = new List <Ingredient>(); try { ingredientList = await IngredientDBAsync.GetsAsync(recipeId); } catch (Exception) { throw; } return(ingredientList); }
public static async Task <CallReturn <Ingredient> > CreateIngredientAsync(IngredientNew ingredient) { var retVal = new CallReturn <Ingredient>(); try { retVal.Object = await IngredientDBAsync.CreateAsync(new IngredientNew { Ingredient = ingredient.Ingredient, RecipeId = ingredient.RecipeId }); } catch (Exception ex) { Console.WriteLine(ex); retVal.SetError(ErrorType.SystemError, ex); } return(retVal); }