public IActionResult CreateForm( ) { Random va = new Random(); table_1 Table_1 = new table_1(); Table_1.UID_F = va.Next(); Table_1.Form_Name = Request.Form["form-name"]; Table_1.Creator = Request.Form["creators-name"]; Table_1.Created_On = DateTime.Now.ToString("h:mm:ss "); _formRepository.Add_1(Table_1); table_2 Table_2 = new table_2(); int i = 0; while (true) { if (!string.IsNullOrEmpty(Request.Form[$"ques-{i}"])) { Table_2.UID_F1 = Table_1.UID_F; Table_2.UID_Q = i; Table_2.Question_Type = Request.Form[$"sel-{i}"]; Table_2.Question = Request.Form[$"ques-{i}"]; _formRepository.Add_2(Table_2); if (Table_2.Question_Type == "radio" || Table_2.Question_Type == "checkbox") { table_3 Table_3 = new table_3(); int j = 1; while (true) { if (!string.IsNullOrEmpty(Request.Form[$"radio-{i}-{j}"])) { Table_3.F2 = Table_1.UID_F; Table_3.UID_Q = i; Table_3.ID_MCQ = j; Table_3.Options = Request.Form[$"radio-{i}-{j}"]; _formRepository.Add_3(Table_3); j++; } else { break; } } } i++; } else { break; } } return(RedirectToAction("Results", new { id = Table_1.UID_F })); // return View(); }