public static RecipeTags From(params RecipeTag[] tags) { var ret = new RecipeTags(); ret.tags.AddRange(tags); return(ret); }
public static RecipeTags Parse(string list) { var tagsAsString = list.Split(',').Select(t => t.Replace(" ", string.Empty)); var tags = tagsAsString.Select(t => (RecipeTag)Enum.Parse(typeof(RecipeTag), t)).Distinct().ToArray(); var recipeTags = new RecipeTags(tags); return(recipeTags); }
public Recipe(Guid id, RecipeTags tags, IngredientUsage[] ingredients) { this.ingredients = new IngredientUsageCollection(); this.Id = id; this.Tags = tags; this.Ingredients = ingredients; }
public static RecipeTags Parse(string list) { var tags = from t in list.Split(',') select t.Trim(); var ret = new RecipeTags(); ret = tags.Aggregate(ret, (current, tag) => current | (RecipeTag)tag); return(ret); }