/// <summary> Create a new recipe table object </summary> public RecipeTable() { RecipeId = new RecipeId(new NotNull(), new Unique(), new PrimaryKey(true)); RecipeName = new RecipeName(new NotNull(), new Unique()); ProfessionId = new ProfessionId(new NotNull(), new ForeignKey(TableManager.Profession, TableManager.Profession.ProfessionId)); Grade = new Grade(new NotNull()); }
/// <summary> Create a recipe result table object </summary> public RecipeResultTable() { RecipeId = new RecipeId(new NotNull(), new ForeignKey(TableManager.Recipe, TableManager.Recipe.RecipeId)); Tier = new Tier(new NotNull()); ResourceId = new ResourceId(new NotNull(), new ForeignKey(TableManager.Resource, TableManager.Resource.ResourceId)); Amount = new Amount(new NotNull(), new Default <int>(1)); }
public async Task GetRecipeTest() { var recipeId = new RecipeId(ArtisanId.Blacksmith, "apprentice-flamberge"); var recipe = await DiabloApi.Artisan.GetRecipeAsync(AuthenticationScope, recipeId); Assert.IsNotNull(recipe); }
//public object id { get; internal set; } public string GetFileName() { string[] files = Directory.GetFiles(Base); foreach (string s in files) { if (Path.GetFileNameWithoutExtension(s) == RecipeId.ToString()) { return(Path.GetFileName(s)); } } return(null); }
public void DeleteFav(RecipeId recipeId) { using (var con = GetConnection()) { var cmd = con.CreateCommand(); cmd.CommandText = "Delete_Favorite"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@recipeId", recipeId.recipeId); cmd.ExecuteNonQuery(); } }
/// <summary> Get the id of a recipe </summary> /// <param name="recipe">The name of the recipe to get the id for</param> /// <returns>The id of the recipe</returns> public long GetRecipeID(string recipe) { DataTable result = GetDataRows((RecipeName, recipe)); if (result.Rows.Count == 0) { throw new ArgumentException("The recipe does not exist in the database"); } else if (result.Rows.Count > 1) { throw new ArgumentException("There are multiple entries of the recipe in the database"); } return(RecipeId.Parse(result.Rows[0])); }
/// <summary> Load all recipe costs from the database </summary> public override void LoadData() { DataTable table = GetAllData(); foreach (DataRow row in table.Rows) { long recipeId = RecipeId.Parse(row); long resourceId = ResourceId.Parse(row); int amount = Amount.Parse(row); Recipe recipe = TableManager.Recipe.GetRecipe(recipeId); Resource resource = TableManager.Resource.GetResource(resourceId); recipe.AddConsumed(resource, amount); } }
public void Favorite(RecipeId recipeId) { using (var con = GetConnection()) { var cmd = con.CreateCommand(); cmd.CommandText = "Add_Favorite"; cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@recipeId", recipeId.recipeId); try { cmd.ExecuteNonQuery(); } catch (SqlException e) when(e.Message.Contains("duplicate")) { } } }
public async Task <Recipe> GetRecipeAsync(IAuthenticationScope authenticationScope, RecipeId recipeId) { var mapper = new RecipeMapper(recipeId.Id); var artisanSlug = EnumConversionHelper.ArtisanIdentifierToString(recipeId.Id); using (var client = CreateClient(authenticationScope)) { var recipe = await client.GetRecipeAsync(artisanSlug, recipeId.Slug); return(mapper.Map(recipe)); } }
public void DeleteFav(RecipeId recipeId) { //Need to add HttpResponseMessage recipeService.DeleteFav(recipeId); }
public void Favorite(RecipeId recipeId) { //Need to add HttpResponseMessage recipeService.Favorite(recipeId); }
public Recipe FindById(RecipeId recipeId) { return(_context .Recipes .FirstOrDefault(x => x.RecipeId == recipeId)); }