public IActionResult AssignToBatch(StudentBatchViewModel model) { var Selected = model.StudentId; int modelBatchId = model.BatchId; foreach (var item in Selected) { StudentInBatch sb = new StudentInBatch() { BatchesId = modelBatchId, EmployeeId = int.Parse(item) }; _programmes.AssignStudentToBatch(sb); } return(RedirectToAction("listbatch")); }
public ViewResult ListBatch() { List <Batches> batches = _programmes.GetABatch().ToList(); List <Employee> studentList = _students.GetEmployees().ToList(); List <StudentInBatch> studentbatchList = _programmes.GetAllStudentInBatch().ToList(); StudentBatchViewModel sbvm = new StudentBatchViewModel { Batches = batches, Students = studentList, AssignedStudents = studentbatchList }; return(View(sbvm)); }