// GET: Search public ActionResult Search() { var form = new IncidentSearch(); form.options.Add("All"); form.options.Add("Description"); form.options.Add("Student"); form.options.Add("Instructor"); form.options.Add("Course"); return(View(form)); }
public ActionResult Search(int?id, IncidentSearch newItem) { if (!ModelState.IsValid) { return(RedirectToAction("search")); } var foundIncidents = m.IncidentSearch(newItem); if (foundIncidents == null || foundIncidents.Count() == 0) { return(RedirectToAction("search")); } return(View("SearchPost", foundIncidents)); }
public IEnumerable <IncidentBase> IncidentSearch(IncidentSearch newItem) { var o = ds.Incidents.Where(a => a.description.Contains(newItem.searchTerm)); var p = ds.Incidents.Where(a => a.Instructor.name.Contains(newItem.searchTerm)); var q = ds.Students.Where(a => a.name.Contains(newItem.searchTerm)); o = o.Concat(p); if (o == null) { return(null); } else { IEnumerable <IncidentBase> x = Mapper.Map <IEnumerable <IncidentBase> >(o); return(x); } }