public StudentCard(IStudentService studentService)
        {
            viewModel = new StudentCardViewModel(studentService);

            InitializeComponent();

            this.Loaded += StudentsTable_Load;
        }
Example #2
0
        public ActionResult StudentCard(int id, int page = 1, int count = 20, string token = "")
        {
            var profile = _profileRepository.GetStudent(id);

            if (profile == null)
            {
                return(NotFound());
            }
            if (!string.IsNullOrEmpty(token))
            {
                _profileService.GetCurrentAccountByToken(token);
            }
            int currentProfileID    = 0;
            StudentCardViewModel vm = new StudentCardViewModel();

            if (_profileService.CurrentProfile != null && _profileService.CurrentProfile.ID == profile.ID)
            {
                currentProfileID    = _profileService.CurrentProfile.ID;
                vm.IsOwner          = true;
                vm.CurrentProfileID = currentProfileID;
            }
            vm.Student = new StudentViewModel(currentProfileID, profile);

            // Данные об образовании.
            vm.StudentEducation = new StudentEducationViewModel(_profileRepository.GetStudentEducation(id));



            // Получить список контента (записей в ленту).
            var contentList = _contentRepository.GetContentList(id, page, count);
            // Получить последние комментарии для записей в ленту.
            List <Comment> contentCommentList = null;

            if (contentList != null && contentList.Count > 0)
            {
                contentCommentList = _contentRepository.GetLastContentCommentList(contentList.Select(u => u.ID).ToList());
            }
            vm.PrepareContentData(contentList, contentCommentList);

            int totalContentCount = _contentRepository.GetContentListTotalCount(id);

            vm.Pagination = new PaginationData(_localizationService, LinkBuilder.Profile.Card(id), Utils.RequestUtils.GetRequesValues(Request), page, count, totalContentCount);


            // Возможно вы знакомы.
            vm.PreparePossibleFriends(_profileRepository.GetPossibleFriends(currentProfileID));

            // Работодатели.
            vm.PrepareEmployers(_profileRepository.GetRandEmployers());

            // Список друзей (не более 9)
            vm.PrepareFriends(_profileRepository.GetFriendProfileList(id, 2, 1, 9));


            /*
             * // Подписчики (не более 9)
             * vm.SubscriberList = _profileRepository.GetRelationProfileList(id, "subscribers", 2, 1, 9);
             *
             * // Список последних записей всех профилей TODO потом точно будет известно как надо.
             * vm.LastContentList = _contentRepository.GetLastContentList();
             */
            return(Json(vm));
        }
Example #3
0
 public AddStudentDialogView()
 {
     InitializeComponent();
     DataContext = new StudentCardViewModel();
 }