示例#1
0
文件: Form1.cs 项目: YannickB23/Books
        private void LoadBooks()
        {
            BookRepo repo = new BookRepo();

            this.grdBooks.DataSource = null;
            this.grdBooks.DataSource = repo.GetAllBooks();
        }
        private void searchBookTBTextChanged(object sender, EventArgs e)
        {
            List <Book> listOfBook   = bk.GetAllBooks();
            String      keyword      = this.searchBookTB.Text;
            List <Book> searchedBook = listOfBook.FindAll(x => (x.BookId.ToLower()).Contains(keyword.ToLower()) || (x.Title.ToLower()).Contains(keyword.ToLower()) || (x.PublishDate.ToLower()).Contains(keyword.ToLower()) || (x.Place.ToLower()).Contains(keyword.ToLower()) || (x.Author.ToLower()).Contains(keyword.ToLower()));

            BookTable.DataSource = searchedBook;
        }
示例#3
0
        private void BookSearchTextChanged(object sender, EventArgs e)
        {
            //bookSearchTB
            List <Book> listOfBook   = bookRepo.GetAllBooks();
            String      keyword      = this.bookSearchTB.Text;
            List <Book> searchedBook = listOfBook.FindAll(x => (x.BookId.ToLower()).Contains(keyword.ToLower()) || (x.Title.ToLower()).Contains(keyword.ToLower()) || (x.PublishDate.ToLower()).Contains(keyword.ToLower()) || (x.Place.ToLower()).Contains(keyword.ToLower()));

            booksDG.DataSource = searchedBook;
        }
        public Book_Control()
        {
            InitializeComponent();
            cancelBTN.Visible = false;
            removeBTN.Visible = false;
            updateBTN.Visible = false;

            this.bk = new BookRepo();
            List <Book> listofBook = bk.GetAllBooks();

            BookTable.DataSource = listofBook;
        }
示例#5
0
        public List <BookListViewModel> GetAllBooks()
        {
            var books = _bookRepo.GetAllBooks();

            int    n   = books.Count;
            Random rnd = new Random();

            while (n > 1)
            {
                int k = (rnd.Next(0, n) % n);
                n--;
                BookListViewModel value = books[k];
                books[k] = books[n];
                books[n] = value;
            }
            return(books);
        }
示例#6
0
        public borrowcontrol()
        {
            InitializeComponent();
            AutoComplete();
            // borrowDateLB.Text = borrowedDate.Value.ToString();

            //   string a = Convert.ToString(borrowedDate.Value.Date);
            // string[] s = a.Split(' ');
            //  MessageBox.Show(s[0]);
            // MessageBox.Show(startDate);

            this.bookRepo = new BookRepo();
            List <Book> listofBook = bookRepo.GetAllBooks();

            booksDG.DataSource = listofBook;

            dt.Columns.Add("BookID", typeof(string));
            dt.Columns.Add("Title", typeof(string));
            dt.Columns.Add("Classification", typeof(string));
        }
示例#7
0
        public IActionResult AddToCart(int id)
        {
            //var cartItem = _cartRepo.GetCart().SingleOrDefault();
            //var cartItem = _db.Cart;
            var cartdb   = new DataContext();
            var cartItem = new List <Cart>
            {
                new Cart()
                {
                    BookId = id,
                }
            };
            var selectedBook = (from b in _bookRepo.GetAllBooks()
                                orderby b.Id
                                select b).ToList();


            cartdb.AddRange(cartItem);
            cartdb.SaveChanges();
            return(View(selectedBook));
        }
示例#8
0
        //BorrowRecords brecords;
        public Records_Details(string studentid)
        {
            InitializeComponent();
            this.studentid = studentid;
            MessageBox.Show(studentid);

            Student s = srepo.GetStudent(studentid);

            id.Text       = s.Id;
            student.Text  = s.Firstname;
            name.Text     = s.Lastname;
            dept.Text     = s.Dept;
            year.Text     = s.Year;
            contact.Text  = s.Contact;
            borrowed.Text = Convert.ToString(s.Borrowed);
            due.Text      = Convert.ToString(s.Due);

            this.bk = new BookRepo();
            List <Book> listofRecords = bk.GetAllBooks(studentid);

            recordsDetailsDG.DataSource = listofRecords;
        }
示例#9
0
        public List <BookListViewModel> GetAllBooks()
        {
            var books = _bookRepo.GetAllBooks();

            return(books);
        }
示例#10
0
 //method-get----
 public IEnumerable <Book> GetBooks()
 {
     return(_repo.GetAllBooks());
 }
示例#11
0
 public List <BookListViewModel> GetAllBooks()
 {
     return(_bookRepo.GetAllBooks());
 }
示例#12
0
        public IActionResult GetAllBooks()
        {
            var books = _bookrepository.GetAllBooks();

            return(View(books));
        }
示例#13
0
        public IActionResult Index()
        {
            var Books = _bookRepo.GetAllBooks();

            return(View(Books));
        }
示例#14
0
 public List <BookClass> GetAllBooks()
 {
     return(_bookRepo.GetAllBooks());
 }
 public IActionResult AllBooks()
 {
     return(View(_bookRepo.GetAllBooks()));
 }
示例#16
0
        public async Task <ViewResult> Index()
        {
            var books = await _bookRepo.GetAllBooks();

            return(View(books));
        }