public MultipleResult <Employee> Handle(EmployeeSpecificationQuery request) { var employees = _context.Set <Employee>().ToArray(); Array.Sort(employees); return(new MultipleResult <Employee> { Results = employees }); }
public MultipleResult <Employee> Handle(EmployeeSpecificationQuery request) { using (ISession session = DataContext.GetTransactedSession()) { ICriteria criteria = session.CreateCriteria(typeof(Employee)); criteria.SetCacheable(true); IList <Employee> list = criteria.List <Employee>(); Employee[] employees = new List <Employee>(list).ToArray(); Array.Sort(employees); return(new MultipleResult <Employee> { Results = employees }); } }
public static IEnumerable<SelectListItem> GetOptions(string selected) { var bus = DependencyResolver.Current.GetService<Bus>(); var result = new List<SelectListItem>(); var empSpec = new EmployeeSpecificationQuery(); Employee[] employees = bus.Send(empSpec).Results; foreach (Employee employee in employees) { result.Add(new SelectListItem { Text = employee.GetFullName(), Value = employee.UserName, Selected = (employee.UserName == selected) }); } return result; }
public static IEnumerable <SelectListItem> GetOptions(string selected) { var bus = DependencyResolver.Current.GetService <Bus>(); var result = new List <SelectListItem>(); var empSpec = new EmployeeSpecificationQuery(); Employee[] employees = bus.Send(empSpec).Results; foreach (Employee employee in employees) { result.Add(new SelectListItem { Text = employee.GetFullName(), Value = employee.UserName, Selected = (employee.UserName == selected) }); } return(result); }