public List <CommodityShadow> GetCommoditiesFromRecipe(Recipe recipe) { var recipeCommodityModel = new RecipeCommodityModel(_dbPath); var list = recipeCommodityModel.GetRecipeCommodity(recipe); var list_1 = new List <CommodityShadow>(); foreach (var recipeCommodity in list) { Units unit; try { unit = (Units)Enum.Parse(typeof(Units), recipeCommodity.Unit); } catch (ArgumentException) { unit = Units.stk; // Just something } list_1.Add(new CommodityShadow { Id = recipeCommodity.Recipe.Id, Commodity = recipeCommodity.Commodity, Name = recipeCommodity.Commodity.Name, Unit = unit, Value = recipeCommodity.Value }); } return(list_1); }
public List <RecipeCommodity> GetCommodities(Recipe recipe) { var recipeCommodityModel = new RecipeCommodityModel(_dbPath); return(recipeCommodityModel.GetRecipeCommodity(recipe)); }