public IActionResult Index(string firstname, string lastname) { LecturerSearch search = new LecturerSearch(this.DatabaseContext); search.Firstname = firstname; search.Lastname = lastname; ViewBag.Firstname = firstname; ViewBag.Lastname = lastname; this.PutRolesInViewBag(); return(View(search.Search())); }
public IActionResult Index(string designation, string title, int?semester, DateTime?beginDate, DateTime?endDate, int?lecturerId, string status, string courseDesignation) { UnitSearch unitSearch = new UnitSearch(this.DatabaseContext); unitSearch.Designation = designation; unitSearch.Title = title; unitSearch.Semester = semester; unitSearch.BeginDate = beginDate; unitSearch.EndDate = endDate; unitSearch.LecturerId = lecturerId; unitSearch.SetStatus(status); unitSearch.CourseDesignation = courseDesignation; LecturerSearch lecturerSearch = new LecturerSearch(this.DatabaseContext); lecturerSearch.ShowDummyAll = true; lecturerSearch.ShowDummyNone = true; ViewBag.Lecturers = lecturerSearch.Search().Select(eachLecturer => new SelectListItem { Text = eachLecturer.Fullname, Value = eachLecturer.Id.ToString(), Selected = (lecturerId.HasValue && eachLecturer.Id == lecturerId.Value) || (!lecturerId.HasValue && eachLecturer.IsDummyAll) }); ViewBag.UnitTitle = title; ViewBag.Designation = designation; ViewBag.Semester = semester; if (beginDate.HasValue) { ViewBag.BeginDate = beginDate.Value.ToString("yyyy-MM-dd"); } if (endDate.HasValue) { ViewBag.EndDate = endDate.Value.ToString("yyyy-MM-dd"); } ViewBag.Status = status; ViewBag.CourseDesignation = courseDesignation; this.PutRolesInViewBag(); return(View(unitSearch.Search())); }