public ActionResult Kiosk() { var context = new KisokDatabase(); var items = context.Item.Select(x => x.Name); var array = items.ToArray(); ViewBag.data = array; return(View()); }
static void Main(string[] args) { var context = new KisokDatabase(); var item = new Item { Name = "Bread", Price = 2, QuantityType = 1, Stock = 10 }; //context.Item.Add(item); //context.SaveChanges(); var quantityType = context.QuantityTypes.Select(u => u.Type); for (int i = 0; i < quantityType.Count(); i++) { Console.WriteLine(quantityType.ToArray()[i]); } Console.Read(); }