public void Delete(int id)
        {
            using (var context = new DatabaseDemoEntities())
            {
                var item = context.Table.Find(id);

                context.Table.Remove(item);
                context.SaveChanges();
            }
        }
        public int Insert(Item item)
        {
            using (var context = new DatabaseDemoEntities())
            {
                var tableItem = new Table
                {
                    Name = item.Name
                };

                context.Table.Add(tableItem);
                context.SaveChanges();

                return(tableItem.Id);
            }
        }
        public IEnumerable <Item> Get()
        {
            var items = new List <Item>();

            using (var context = new DatabaseDemoEntities())
            {
                items.AddRange(context.Table.Select(item => new Item
                {
                    Id   = item.Id,
                    Name = item.Name
                }));
            }

            return(items);
        }