public async Task <IActionResult> Create([Bind("BookId,Bookname,Category")] Book book)
        {
            if (ModelState.IsValid)
            {
                _context.Add(book);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(book));
        }
Example #2
0
        public async Task <IActionResult> Create([Bind("UserId,Username")] User user)
        {
            if (ModelState.IsValid)
            {
                _context.Add(user);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(user));
        }
Example #3
0
        public async Task <IActionResult> Create([Bind("LibrarianId,UserId,BookId,ManageId,BorrowDay")] Librarian librarian)
        {
            if (ModelState.IsValid)
            {
                _context.Add(librarian);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BookId"] = new SelectList(_context.Book, "BookId", "Bookname", librarian.BookId);
            ViewData["UserId"] = new SelectList(_context.User, "UserId", "Username", librarian.UserId);
            return(View(librarian));
        }
        public async Task <IActionResult> Create([Bind("ManageId,BookId,UserId,ManageDescription")] Manage manage)
        {
            if (ModelState.IsValid)
            {
                _context.Add(manage);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BookId"] = new SelectList(_context.Book, "BookId", "Bookname", manage.BookId);
            ViewData["UserId"] = new SelectList(_context.User, "UserId", "Username", manage.UserId);
            return(View(manage));
        }