public async Task <IActionResult> Index()
        {
            var roles = await _roleManager.GetAll().ToListAsync();

            ViewData["roles"] = roles;
            var specialities = (await _specialityManager.GetAll().ToListAsync()).OrderBy(o => o.Sort).ToList();

            ViewData["specialities"] = specialities;
            return(View());
        }
        public void GetAllReturnsAViewResultWithAListOfSpecialities()
        {
            // Arrange
            var config = new MapperConfiguration(cfg => cfg.CreateMap <Speciality, SpecialityDTO>());
            var mock   = new Mock <IUnitOfWork>();

            mock.Setup(unitOfWork => unitOfWork.Specialities.GetAll()).Returns(GetAllTestSpecialityDTO());
            var manager = new SpecialityManager(mock.Object, new AttributeValidator(), new Mapper(config));

            // Act
            var result = manager.GetAll();

            // Assert
            var viewResult = Assert.IsType <List <SpecialityDTO> >(result);
            var model      = Assert.IsAssignableFrom <IEnumerable <SpecialityDTO> >(viewResult);

            Assert.Equal(GetAllTestSpecialityDTO().Count, model.Count());
        }
        /// <summary>
        /// 评选活动选入专家
        /// </summary>
        /// <param name="reviewId"></param>
        /// <returns></returns>
        public async Task <IActionResult> SelExpert(int reviewId)
        {
            var review = await ReviewRepository.GetAllIncluding(o => o.Major).Where(o => o.Id == reviewId).SingleAsync();

            //List<Major> subMajors=new List<Major>();
            //if (review.SubMajorId == null)
            //{
            //    //如果未指定专业小类,需要列出所有专业小类供查询
            //    subMajors = await MajorManager.FindChildrenAsync(null, review.MatchInstanceId, review.MajorId);
            //}
            //else
            //{
            //    ViewBag.SubMajor = await MajorManager.GetByIdAsync(review.SubMajorId.Value);
            //}
            //ViewBag.SubMajors = subMajors;
            var specialities = await SpecialityManager.GetAll().OrderBy(o => o.Name).ToListAsync();

            ViewBag.Specialities = specialities;
            ViewBag.Exclude      = Request.Cookies["excludeExperts"];
            return(View(review));
        }