コード例 #1
0
        public async Task <IActionResult> Create([Bind("CatId,CatName")] Categories categories)
        {
            if (ModelState.IsValid)
            {
                _context.Add(categories);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(categories));
        }
コード例 #2
0
        public async Task <IActionResult> Create([Bind("SubId,SubName,CatId")] Subcategories subcategories)
        {
            if (ModelState.IsValid)
            {
                _context.Add(subcategories);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CatId"] = new SelectList(_context.Categories, "CatId", "CatName", subcategories.CatId);
            return(View(subcategories));
        }
コード例 #3
0
        public async Task <IActionResult> Create([Bind("PdfId,PdfName,SubId")] Pdfs pdfs)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pdfs);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SubId"] = new SelectList(_context.Subcategories, "SubId", "SubName", pdfs.SubId);
            return(View(pdfs));
        }
コード例 #4
0
        public async Task <IActionResult> Create([Bind("Question,Answer,QaId,SubId")] QaDetails qaDetails)
        {
            if (ModelState.IsValid)
            {
                _context.Add(qaDetails);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["SubId"] = new SelectList(_context.Subcategories, "SubId", "SubName", qaDetails.SubId);
            return(View(qaDetails));
        }