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

                return(RedirectToAction(nameof(Index)));
            }
            return(View(book));
        }
Beispiel #2
0
        public async Task <IActionResult> Create([Bind("Id,Name,Email,ContactNumber")] Reader reader)
        {
            if (ModelState.IsValid)
            {
                _context.Add(reader);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(reader));
        }
Beispiel #3
0
        public async Task <IActionResult> Create([Bind("Id,BookId,ReaderId,OrderId")] Seller seller)
        {
            if (ModelState.IsValid)
            {
                _context.Add(seller);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BookId"]   = new SelectList(_context.Book, "Id", "Id", seller.BookId);
            ViewData["ReaderId"] = new SelectList(_context.Reader, "Id", "Id", seller.ReaderName);
            return(View(seller));
        }