public void AddTimeCategories(string day, int start, int finish) { BDContext db = new BDContext(); using (db) { TimeCategory value = new TimeCategory(); value.Day = day; value.Start = start; value.Finish = finish; db.TimeCategories.Add(value); db.SaveChanges(); } }
public string[,] ShowAllTimeCategories() { BDContext db = new BDContext(); string[,] age = new string[15, 3]; using (db) { TimeCategory[] Age = new TimeCategory[15]; Age = db.TimeCategories.ToArray(); for (int i = 0; i < age.GetLength(0); i++) { age[i, 0] = Age[i].Day; age[i, 1] = Convert.ToString(Age[i].Start); age[i, 2] = Convert.ToString(Age[i].Finish); } } return(age); }