public ActionResult Index(string id) //id - clientID
        {
            MXTimer timing = new MXTimer();

            var model = _repository.GetOne <Client>(id);

            ViewBag.QueryTime = timing.Finish();

            return(View(model));
        }
Пример #2
0
        public ActionResult Edit(string id)
        {
            MXTimer timing = new MXTimer();

            ClientViewModel model = new ClientViewModel
            {
                Client = _repository.GetOne <Client>(id),
            };

            ViewBag.QueryTime = timing.Finish();

            return(View(model));
        }
        public ActionResult Edit(string id)//employeeId
        {
            MXTimer timing = new MXTimer();

            EmployeeViewModel model = new EmployeeViewModel
            {
                Employee = _repository.GetOne <Employee>(id),
            };

            //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();

            foreach (var item in model.LstSkill)
            {
                if (model.Employee.Skills != null && model.Employee.Skills.Select(c => c.DenormalizedId).Contains(item.DenormalizedReference.DenormalizedId))
                {
                    item.IsSelected = true;
                }
            }

            Task.WaitAll(tasks);

            ViewBag.QueryTime = timing.Finish();

            return(View(model));
        }