static List <Recepie> Shuffle(List <Recepie> array) { Random random = new Random(); int n = array.Count; for (int i = 0; i < array.Count; i++) { int r = i + random.Next(n - i); Recepie t = array[r]; array[r] = array[i]; array[i] = t; } return(array); }
private static void InsertRecepieIntoDatabase(string name, List <Ingredient> ingredients, List <Category> categories, NHibernate.ISession session) { Recepie recepie = new Recepie(); recepie.Name = name; foreach (Ingredient ingredient in ingredients) { recepie.AddIngredient(ingredient); session.Save(ingredient); } foreach (Category category in categories) { recepie.AddCategory(category); category.AddRecepie(recepie); session.Save(category); } session.Save(recepie); }
private static List <Category> GetCategoryByRecepie(Recepie recepie, NHibernate.ISession session) { var categories = session.Query <Category>().ToList(); return(categories); }
private static List <Ingredient> GetIngredientsByRecepie(Recepie recepie, NHibernate.ISession session) { var ingredients = session.Query <Ingredient>().ToList(); return(ingredients); }
public virtual void AddRecepie(Recepie recepie) { Recepies.Add(recepie); recepie.Ingredients.Add(this); }
public virtual void AddRecepie(Recepie recepie) { Recepies.Add(recepie); recepie.Categories.Add(this); }