コード例 #1
0
        public async Task <IActionResult> Create([Bind("CategoryId,TitleName")] Category category)
        {
            if (ModelState.IsValid)
            {
                _context.Add(category);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(category));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("Id,Firstname,Lastname,Email,Address,Phone,Useraccountid")] Readers readers)
        {
            if (ModelState.IsValid)
            {
                _context.Add(readers);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(ProfileInfo)));
            }
            return(View(readers));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("BookId,CategoryId,TitleName,AuthorName,PublishYear")] Library library)
        {
            if (ModelState.IsValid)
            {
                _context.Add(library);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CategoryId"] = new SelectList(_context.Category, "CategoryId", "TitleName", library.CategoryId);
            return(View(library));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("PaymentId,CardNumber,VerificationNumber,UserId,OrderId,ExperationDate")] Payment payment)
        {
            if (ModelState.IsValid)
            {
                _context.Add(payment);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["OrderId"] = new SelectList(_context.Orders, "OrderId", "OrderId", payment.OrderId);
            ViewData["UserId"]  = new SelectList(_context.Readers, "Id", "Address", payment.UserId);
            return(View(payment));
        }
コード例 #5
0
        public async Task <IActionResult> Create([Bind("OrderId,BookId,BookPrice,UserId")] Orders orders)
        {
            if (ModelState.IsValid)
            {
                _context.Add(orders);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["BookId"] = new SelectList(_context.Library, "BookId", "AuthorName", orders.BookId);
            ViewData["UserId"] = new SelectList(_context.Readers, "Id", "Address", orders.UserId);
            return(View(orders));
        }