コード例 #1
0
        public ResourceReserveListViewModel GetListViewModel(Guid resourceID)
        {
            var viewModel = new ResourceReserveListViewModel();

            viewModel.ResourceTypes = this.ResourceTypeRepository.GetAll().ToArray();
            viewModel.Resources = this.ResourceRepository.GetAll().ToArray();

            viewModel.SearchResourceID = resourceID;
            viewModel.Items = this.ResourceReserveRepository.GetByResourceID(resourceID)
                .ToArray()
                .Select(x => this.EntityToViewModel(x))
                .ToArray();

            return viewModel;
        }
コード例 #2
0
        public ResourceReserveListViewModel GetListViewModel(ResourceReserveListViewModel sourceViewModel = null)
        {
            var viewModel = new ResourceReserveListViewModel();

            viewModel.ResourceTypes = this.ResourceTypeRepository.GetAll().ToArray();
            viewModel.Resources = this.ResourceRepository.GetAll().ToArray();

            if (sourceViewModel != null)
            {
                viewModel.SearchResourceTypeID = sourceViewModel.SearchResourceTypeID;
                viewModel.SearchResourceID = sourceViewModel.SearchResourceID;
                viewModel.Items = this.ResourceReserveRepository.GetByResourceID(sourceViewModel.SearchResourceID.Value)
                    .ToArray()
                    .Select(x => this.EntityToViewModel(x))
                    .ToArray();
            }

            return viewModel;
        }