Esempio n. 1
0
        public async Task <Head> CurrentHead()
        {
            try
            {
                _logger.LogInformation("begin");
                var userId = _currentUser.Id.Value;
                _logger.LogInformation(userId.ToString());
                var user = await _userRepository.GetAsync(userId);

                _logger.LogInformation(user.ToString());

                var head = await _headRepository.GetIncludeAsync(user.BelongHeadId.Value);

                _logger.LogInformation(head.ToString());

                head.AddBrowseCount();

                _logger.LogInformation("end");
                return(head);
            }
            catch (Exception e)
            {
                _logger.LogError(e.ToString());
                return(null);
            }
        }
Esempio n. 2
0
        public async Task <HeadDto> GetAsync()
        {
            var headId = _currentUser.Id.Value;
            var head   = await _headRepository.GetIncludeAsync(headId);

            var headDto = ObjectMapper.Map <Head, HeadDto>(head);

            headDto.FansCount = _userRepository.GetHeadFansCount(headId);
            return(headDto);
        }