Esempio n. 1
0
        public void fvBook_InsertItem()
        {
            Book item = new Book();

            TryUpdateModel(item);
            if (ModelState.IsValid)
            {
                BooksInventoryEntities _db = new BooksInventoryEntities();
                _db.Books.Add(item);
                _db.SaveChanges();
                Response.Redirect("/ViewBooks.aspx");
            }
        }
Esempio n. 2
0
        // The return type can be changed to IEnumerable, however to support
        // paging and sorting, the following parameters must be added:
        //     int maximumRows
        //     int startRowIndex
        //     out int totalRowCount
        //     string sortByExpression
        public IQueryable gvBooks_GetData()
        {
            BooksInventoryEntities _db = new BooksInventoryEntities();

            return(_db.Books);
        }