public ActionResult Create() { MXTimer timing = new MXTimer(); EmployeeViewModel model = new EmployeeViewModel(); //let's go parallel Task[] tasks = new Task[2]; tasks[0] = Task.Factory.StartNew( () => model.LstGender = _repository.GetOptionSet <Gender, DenormalizedReference>() ); tasks[1] = Task.Factory.StartNew( () => model.LstRating = _repository.GetOptionSet <ProgrammingRating, DenormalizedReference>() ); model.LstSkill = _repository.GetOptionSet <Skill, DenormalizedReference>().Select(c => new MXCheckBoxItem { DenormalizedReference = c }).ToList(); Task.WaitAll(tasks); ViewBag.QueryTime = timing.Finish(); return(View(model)); }
public JsonResult LoadDataForAutoComplete(string term) { try { var predicate = MXPredicateBuilder.True <ClientType>(); predicate = predicate.And(p => p.Name.ToLower().Contains(term)); var results = _repository.GetOptionSet <ClientType, DenormalizedReference>(predicate); var myData = results.Select(a => new SelectListItem() { Text = a.DenormalizedName, Value = a.DenormalizedId, }); return(Json(myData, JsonRequestBehavior.AllowGet)); } catch (Exception ex) { return(Json("Error Occurred: " + ex.Message, JsonRequestBehavior.AllowGet)); } }