예제 #1
0
        /// <summary>
        /// 设置与传入的视图模型相关的关联元素的集合值
        /// </summary>
        /// <param name="boVM"></param>
        /// <param name="courseID"></param>
        /// <returns></returns>
        public async Task SetTypeItems(CourseItemVM boVM, Guid courseID)
        {
            var boCollection = await _boRepository.GetAllAsyn(y => y.Course.Id == courseID);

            boVM.ParentCourseItemCollection = SelfReferentialItemFactory <CourseItem> .GetCollection(boCollection.OrderBy(x => x.SortCode).ToList(), true);

            boVM.CourseItemCollection = PlainFacadeItemFactory <Course> .Get(_courseRepository);
        }
        /// <summary>
        /// 设置用于前端页面需要的关联数据选项
        /// </summary>
        public void SetRelevanceItems(DepartmentVM boVM)
        {
            boVM.DepartmentTypeItemCollection = PlainFacadeItemFactory <Department> .GetByEnum(boVM.DepartmentType);

            boVM.ParentDepartmentItemCollection = SelfReferentialItemFactory <Department> .GetCollection(_boRepository, true);

            boVM.OrganizationItemCollection = PlainFacadeItemFactory <Organ> .Get(_orgRepository);

            boVM.ApplicationRoleItemCollection = _GetApplicationRoleItemCollection(_roleManager.Roles.ToList());
        }
        /// <summary>
        /// 设置用于前端页面需要的下拉数据选项
        /// </summary>
        public void SetTypeItems(EmployeeVM boVM)
        {
            boVM.ParentDepartmentItemCollection = SelfReferentialItemFactory <Department> .GetCollection(_departmentRepository, true);

            boVM.JobTitleItemCollection = PlainFacadeItemFactory <JobTitle> .Get(_jobTitleRepository);
        }