예제 #1
0
        public async Task <IActionResult> Create([Bind("ID,FullName,DateOfBirth,Sex,Adres,PhoneNumber,PassportData")] Reader reader)
        {
            if (ModelState.IsValid)
            {
                _context.Add(reader);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(reader));
        }
예제 #2
0
        public async Task <IActionResult> Create([Bind("ID,RegistrationNumber,Name,Author,Edition,YearOfEdition,JenreID,Price")] Book book)
        {
            if (ModelState.IsValid)
            {
                _context.Add(book);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["JenreID"] = new SelectList(_context.Jenre, "ID", "Name", book.JenreID);
            return(View(book));
        }
        public async Task <IActionResult> Create([Bind("ID,ReaderID,BookID,DateOfIssuance,DateOfReturn,Return")] Issuence issuence)
        {
            if (ModelState.IsValid)
            {
                _context.Add(issuence);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BookID"]   = new SelectList(_context.Book, "ID", "Name", issuence.BookID);
            ViewData["ReaderID"] = new SelectList(_context.Reader, "ID", "FullName", issuence.ReaderID);
            return(View(issuence));
        }