public ActionResult StudentIssueReport(StudentReportModel model) { try { employee employee = db.employees.Single(emp => emp.employeeid == User.Identity.Name); IEnumerable<student> students = db.students; List<AutoCompletePOCO> StudentID = new List<AutoCompletePOCO>(); foreach (student stud in students) { AutoCompletePOCO poco = new AutoCompletePOCO() { value = stud.fname + " " + stud.lname + " (" + stud.studentid + ")", Label = stud.fname + " " + stud.lname + " (" + stud.studentid + ")", Email = stud.email, Role = "Student" }; StudentID.Add(poco); } model.Student = model.StudentID.Remove(0, model.StudentID.Length - 10); model.Student = model.Student.Remove(model.Student.Length - 1); model.StudID = StudentID; model.User = employee.fname + " " + employee.lname + " (" + employee.employeeid + ")"; return View(model); } catch (Exception ex) { return View(model); } }
// // GET: /Reports/StudentIssueReport public ActionResult StudentIssueReport() { try { employee employee = db.employees.Single(emp => emp.employeeid == User.Identity.Name); IEnumerable<student> students = db.students; List<AutoCompletePOCO> StudentID = new List<AutoCompletePOCO>(); foreach (student stud in students) { AutoCompletePOCO poco = new AutoCompletePOCO() { value = stud.fname + " " + stud.lname + " (" + stud.studentid + ")", Label = stud.fname + " " + stud.lname + " (" + stud.studentid + ")", Email = stud.email, Role = "Student" }; StudentID.Add(poco); } StudentReportModel model = new StudentReportModel() { StudentID = "", Student = "", StartDate = db.issues.OrderBy(i => i.date).First().date, EndDate = db.issues.OrderByDescending(i => i.date).First().date, StudID = StudentID, User = employee.fname + " " + employee.lname + " (" + employee.employeeid + ")" }; return View(model); } catch (Exception ex) { return View(); } }