public JsonResult GetCitizens(Select2Request request)
        {
            string query = request.Query.Trim().ToLower();

            var citizens = citizenRepository
                           .Where(citizen => citizen.Entity.Name.ToLower().Contains(query))
                           .OrderBy(citizen => citizen.Entity.Name)
                           .Select(citizen => new Select2Item()
            {
                id   = citizen.ID,
                text = citizen.Entity.Name
            });

            return(Select2Response(citizens, request));
        }
Beispiel #2
0
 public Citizen GetTestCitizen()
 {
     return(CitizenRepository
            .Where(c => c.Entity.Name == "test2")
            .First());
 }