// コピー public void copy(Wired wired) { foreach (var e in wired.wireKeys_) { wireKeys_[e.Key] = e.Value; } }
public IActionResult GetWiredContent(int WiredID) { return(Content(Wired.GetWireds().FirstOrDefault(f => f.ID == WiredID).content)); }
// Wiredを登録 public void registerWired(Wired wired) { wired_ = wired; }
public IActionResult Create(CreateExamVM model) { Wired wired = Wired.GetWireds().FirstOrDefault(f => f.ID == model.wired); if (ModelState.IsValid) { try { Test Test = new Test { ReleaseDate = DateTime.Now, title = wired.title, content = wired.content }; repoTest.Add(Test); for (int i = 0; i < model.Question.Length; i++) { Question question = new Question { name = model.Question[i], TestID = Test.ID }; repoQuestion.Add(question); repoOption.Add(new Option { answer = model.A[i], pIndex = 1, QuestionID = question.ID, correct = model.correct[i] == 1 ? true : false }); repoOption.Add(new Option { answer = model.B[i], pIndex = 2, QuestionID = question.ID, correct = model.correct[i] == 2 ? true : false }); repoOption.Add(new Option { answer = model.C[i], pIndex = 3, QuestionID = question.ID, correct = model.correct[i] == 3 ? true : false }); repoOption.Add(new Option { answer = model.D[i], pIndex = 4, QuestionID = question.ID, correct = model.correct[i] == 4 ? true : false }); } return(RedirectToAction(nameof(Index))); } catch (Exception) { return(View(model)); } } else { return(View()); } }
public IActionResult Create() { List <Wired> wireds = Wired.GetWireds(); return(View(wireds)); }