protected void DataPortal_Fetch(EmployeeSearchCriteria criteria) { RaiseListChangedEvents = false; IsReadOnly = false; using (var ctx = new VacationManagerContext()) { IList<Persistence.Model.EmployeeEntity> employees; if (criteria == null) employees = ctx.Employees .ToList(); else employees = ctx.Employees .Where(x => (x.Firstname == criteria.FirstName) || (x.LastName == criteria.LastName)) .ToList(); foreach (var item in employees) Add(DataPortal.Create<Employee>(item)); } IsReadOnly = true; RaiseListChangedEvents = true; }
public PartialViewResult Search(string firstName, string lastName) { var criteria = new EmployeeSearchCriteria { FirstName = firstName, LastName = lastName, }; _employees = _dataService.FetchList<EmployeeInfoList, Employee>(criteria); return PartialView("_Employees", _employees); }