public static async Task <CallReturn <Recipe> > GetRecipeAsync(int id) { var retVal = new CallReturn <Recipe>(); try { retVal.Object = await RecipeDBAsync.GetAsync(id); } catch (Exception ex) { retVal.SetError(ErrorType.SystemError, ex); } return(retVal); }
public static async Task <CallReturn <int> > DeleteRecipeAsync(int id) { var retVal = new CallReturn <int>(); try { await RecipeDBAsync.DeleteAsync(id); } catch (Exception ex) { retVal.SetError(ErrorType.SystemError, ex); } return(retVal); }
public static async Task <CallReturn <Recipe> > CreateRecipeAsync(RecipeNew recipe) { var retVal = new CallReturn <Recipe>(); try { retVal.Object = await RecipeDBAsync.CreateAsync(new RecipeNew { RecipeName = recipe.RecipeName }); } catch (Exception ex) { Console.WriteLine(ex); retVal.SetError(ErrorType.SystemError, ex); } return(retVal); }
public static async Task <CallReturn <int> > UpdateRecipeAsync(RecipeNew recipe) { var retVal = new CallReturn <int>(); try { await RecipeDBAsync.UpdateAsync(new RecipeNew { Id = recipe.Id, RecipeName = recipe.RecipeName }); } catch (Exception ex) { retVal.SetError(ErrorType.SystemError, ex); throw; } return(retVal); }
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); }