// This is the Select methd to selects a single Person item with the id
        // USAGE: <asp:FormView SelectMethod="GetItem">
        public AsyncWebAppDemo.Model.Person GetItem([FriendlyUrlSegmentsAttribute(0)]int? ID)
        {
            if (ID == null)
            {
                return null;
            }

            using (var context = new PeopleContext())
            {
                return context.People.Find(ID);
            }
        }
        // This is the Delete methd to delete the selected Person item
        // USAGE: <asp:FormView DeleteMethod="DeleteItem">
        public void DeleteItem(int ID)
        {
            using (var context = new PeopleContext())
            {
                var item = context.People.Find(ID);

                if (item != null)
                {
                    context.People.Remove(item);
                    context.SaveChanges();
                }
            }
            Response.Redirect("../Default");
        }
        // This is the Insert method to insert the entered Person item
        // USAGE: <asp:FormView InsertMethod="InsertItem">
        public void InsertItem()
        {
            using (var context = new PeopleContext())
            {
                var item = new Person();

                TryUpdateModel(item);

                if (ModelState.IsValid)
                {
                    // Save changes
                    context.People.Add(item);
                    context.SaveChanges();

                    Response.Redirect("Default");
                }
            }
        }
        // This is the Update methd to update the selected Person item
        // USAGE: <asp:FormView UpdateMethod="UpdateItem">
        public void UpdateItem(int ID)
        {
            using (var context = new PeopleContext())
            {
                var item = context.People.Find(ID);

                if (item == null)
                {
                    // The item wasn't found
                    ModelState.AddModelError("", String.Format("Item with id {0} was not found", ID));
                    return;
                }

                TryUpdateModel(item);

                if (ModelState.IsValid)
                {
                    // Save changes here
                    context.SaveChanges();
                    Response.Redirect("../Default");
                }
            }
        }
        // Model binding method to get List of Person entries
        // USAGE: <asp:ListView SelectMethod="GetData">
        public IQueryable<Person> GetData()
        {
            var context = new PeopleContext();

            return context.People;
        }