public async Task <IActionResult> Edit(int id, [Bind("FNId,Name")] FaultNameModel faultNameModel) { if (id != faultNameModel.FNId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(faultNameModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FaultNameModelExists(faultNameModel.FNId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(faultNameModel)); }
public async Task <IActionResult> Edit(int id, [Bind("FMId,FFId,CId,Description,QId")] FeaturesMappingModel featuresMappingModel) { if (id != featuresMappingModel.FMId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(featuresMappingModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!FeaturesMappingModelExists(featuresMappingModel.FMId)) { return(NotFound()); } else { throw; } } 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> Edit(int id, [Bind("PId,Name,PaperworkNumber,Unit,Major,PhoneNumber,Email,WeChat,CardNumber,BankName,Password,Salt,Type")] ProfessorModel professorModel) { if (id != professorModel.PId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(professorModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ProfessorModelExists(professorModel.PId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(professorModel)); }
public async Task <IActionResult> Edit(int id, [Bind("QId,Answer,PId,FNId")] QuestionsModel questionsModel) { if (id != questionsModel.QId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(questionsModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!QuestionsModelExists(questionsModel.QId)) { return(NotFound()); } else { throw; } } 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)); }
public async Task <IActionResult> Edit(int id, [Bind("AId,Name,Type,Pattern")] ApparatusModel apparatusModel) { if (id != apparatusModel.AId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(apparatusModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ApparatusModelExists(apparatusModel.AId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } return(View(apparatusModel)); }
public async Task <IActionResult> Edit(int id, [Bind("CId,Name,Specification,AId")] ComponentModel componentModel) { if (id != componentModel.CId) { return(NotFound()); } if (ModelState.IsValid) { try { _context.Update(componentModel); await _context.SaveChangesAsync(); } catch (DbUpdateConcurrencyException) { if (!ComponentModelExists(componentModel.CId)) { return(NotFound()); } else { throw; } } return(RedirectToAction(nameof(Index))); } ViewData["AId"] = new SelectList(_context.GetApparatusModels, "AId", "Name", componentModel.AId); return(View(componentModel)); }