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 void OnObjectCreated(ulong subID, string Json) { ObjectCreatedJsonObject CreatedObject = ObjectCreatedJsonObject.Create(Json); if (CreatedObject != null) { string Result; var Args = new ObjectGetArgs { from = new ObjectGetArgs.From { id = new[] { [email protected] } } }; var Options = new CallOptions { @return = new[] { "name", "type", "path" } }; AkWaapiClient.Call("ak.wwise.core.object.get", Args, Options, out Result); var ReturnedObject = CallReturn.Create(Result); Debug.Log("New object of type " + ReturnedObject.@return[0].type + " named " + ReturnedObject.@return[0].name + " with ID " + [email protected] + " created at path " + ReturnedObject.@return[0].path); } }
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); }