Пример #1
0
        public ActionResult Index(int? id) //id - pageNo.
        {
            IList<Employee> model;

            MXTimer timing = new MXTimer();

            var page = id ?? 0;

            if (page == 0)
            {
                model = _repository.GetMany<Employee>(take: takeCount);

                model = model.OrderBy(c => c.Name).ToList();

                ViewBag.QueryTime = timing.Finish();

                if (model.Count < 1)
                {
                    ViewBag.ShowDummyButton = true;
                }

                return View(model);
            }

            return PartialView("_Employees", GetPaginatedItems(page));
        }
Пример #2
0
        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);
        }
Пример #3
0
        //
        // GET: /FlagSetting/
        public ActionResult Index()
        {
            MXTimer timing = new MXTimer();

            var model = _repository.Get();

            ViewBag.QueryTime = timing.Finish();

            return View(model);
        }
Пример #4
0
        //
        // GET: /FlagSetting/Edit/5
        public ActionResult Edit(string id)
        {
            MXTimer timing = new MXTimer();

            var model = _repository.GetOne(id);

            ViewBag.QueryTime = timing.Finish();

            return View(model);
        }
Пример #5
0
        //id- ClientID
        public ActionResult CompleteDetails(string id)
        {
            MXTimer timing = new MXTimer();

            ViewBag.ParentItemName = _repository.GetNameById<Client>(id);

            ViewBag.QueryTime = timing.Finish();

            return View();
        }
Пример #6
0
        public ActionResult Create()
        {
            MXTimer timing = new MXTimer();

            var model = _bookRepository.GetBookViewModel();

            ViewBag.QueryTime = timing.Finish();

            return View(model);
        }
Пример #7
0
        private IList<Employee> GetPaginatedItems(int page = 1)
        {
            var skipRecords = page * takeCount;

            MXTimer timing = new MXTimer();

            var model = _repository.GetMany<Employee>(skip: skipRecords, take: takeCount);

            ViewBag.QueryTime = timing.Finish();

            return model;
        }
Пример #8
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);
        }
Пример #9
0
        public ActionResult History(string id) //id - employeeID
        {
            MXTimer timing = new MXTimer();

            var model = _repository.GetHistory<Employee>(id);

            ViewBag.QueryTime = timing.Finish();

            return View(model);
        }
Пример #10
0
        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);
        }
Пример #11
0
        /// <summary>
        /// the results here are coming from ElasticSearch server
        /// </summary>
        /// <param name="term"></param>
        /// <returns></returns>
        public ActionResult IndexSub(string term = "")
        {
            MXTimer timing = new MXTimer();

            var results = _bookRepository.Search(term);

            ViewBag.QueryTime = timing.Finish();

            return View(results);
        }