Esempio n. 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));
        }
        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));
        }
        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));
        }
        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));
        }