public ActionResult CustomerSearch(string searchExp = "") { var found = m.CustomerGetByString(searchExp); if (found == null) { found = m.CustomersGetAll(); } //TODO: check if safe when search box empty // Create a new selectlist (this is a partial view) var newList = new WorkOrderPartial(); //uses the same view model class as the view we called the ajax function from newList.CustomerSearchList = new SelectList(found, dataValueField: "Id", dataTextField: "CustListLabel"); //set the partial view's selectList to hold our search results return(PartialView("_CustList", newList)); }
public ActionResult MechanicSearch(string searchExp = "") { IEnumerable <MechanicWithWorkOrders> found = m.MechanicGetByString(searchExp); if (found == null) { found = m.MechanicsGetWithWorkOrders(); } //TODO: consider changing this so customer list is repopulated to being empty on workorder form // Create a new selectlist (this is a partial view) var newList = new WorkOrderPartial(); //uses the same view model class as the view we called the ajax function from newList.MechanicSearchList = new SelectList(found, dataValueField: "Id", dataTextField: "MechListLabel"); //set the partial view's selectList to hold our search results return(PartialView("_MechList", newList)); }