Ejemplo n.º 1
0
        public async Task <IActionResult> Create([Bind("PId,Name,PaperworkNumber,Unit,Major,PhoneNumber,Email,WeChat,CardNumber,BankName,Password,Salt,Type")] ProfessorModel professorModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(professorModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(professorModel));
        }
        public async Task <IActionResult> Create([Bind("FNId,Name")] FaultNameModel faultNameModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(faultNameModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(faultNameModel));
        }
Ejemplo n.º 3
0
        public async Task <IActionResult> Create([Bind("AId,Name,Type,Pattern")] ApparatusModel apparatusModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(apparatusModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(apparatusModel));
        }
        public async Task <IActionResult> Create([Bind("CId,Name,Specification,AId")] ComponentModel componentModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(componentModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["AId"] = new SelectList(_context.GetApparatusModels, "AId", "Name", componentModel.AId);
            return(View(componentModel));
        }
Ejemplo n.º 5
0
        public async Task <IActionResult> Create([Bind("FMId,FFId,CId,Description,QId")] FeaturesMappingModel featuresMappingModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(featuresMappingModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CId"]  = new SelectList(_context.GetComponentModels, "CId", "Name", featuresMappingModel.CId);
            ViewData["FFId"] = new SelectList(_context.GetFaultFeaturesModels, "FFId", "Name", featuresMappingModel.FFId);
            ViewData["QId"]  = new SelectList(_context.GetQuestionsModels, "QId", "Answer", featuresMappingModel.QId);
            return(View(featuresMappingModel));
        }
        public async Task <IActionResult> Create([Bind("RMId,FRId,CId,Probability,QId")] ResultsMappingModel resultsMappingModel)
        {
            if (ModelState.IsValid)
            {
                _context.Add(resultsMappingModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["CId"]  = new SelectList(_context.GetComponentModels, "CId", "Name", resultsMappingModel.CId);
            ViewData["FRId"] = new SelectList(_context.GetFaultResultsModels, "FRId", "FRId", resultsMappingModel.FRId);
            ViewData["QId"]  = new SelectList(_context.GetQuestionsModels, "QId", "Answer", resultsMappingModel.QId);
            return(View(resultsMappingModel));
        }
Ejemplo n.º 7
0
        public async Task <IActionResult> Create([Bind("QId,Answer,FNId")] QuestionsModel questionsModel)
        {
            if (ModelState.IsValid)
            {
                questionsModel.PId = (await _context.GetProfessorModels
                                      .FirstOrDefaultAsync(x => x.Email == User.FindFirst(ClaimTypes.Sid).Value)).PId;

                _context.Add(questionsModel);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            ViewData["FNId"] = new SelectList(_context.GetFaultNameModels, "FNId", "Name", questionsModel.FNId);
            //ViewData["PId"] = new SelectList(_context.GetProfessorModels, "PId", "Name", questionsModel.PId);
            return(View(questionsModel));
        }