예제 #1
0
        public ActionResult Index(int page = 1)
        {
            var pageSize    = 15;
            var instruments = _instrumentService.GetInstruments().Select(
                i => new InstrumentViewModel
            {
                Id              = i.Id,
                Description     = i.Description,
                Manufacturer    = i.Manufacturer,
                ModelNo         = i.ModelNo,
                Range           = i.Range,
                CalibrationTime = i.AllocatedCalibrationTime
            }).OrderBy(i => i.Manufacturer).Skip((page - 1) * pageSize).Take(pageSize);
            var viewModel = new InstrumentListViewModel
            {
                Instruments     = instruments,
                CreateViewModel = new InstrumentViewModel(),
                Page            = page,
                PageSize        = pageSize,
                Total           = _instrumentService.GetInstrumentsCount()
            };

            return(View(viewModel));
        }