Ejemplo n.º 1
0
        public async Task <RepositoryViewModel> Get(int id)
        {
            Repository source = _repositoryRepository.GetById(id);

            source.Owner = _ownerRepository.GetById(source.OwnerId);
            ReadMe readMe = await _githubService.GetReadMe(source.Owner.Login, source.Name);

            source.ReadMe = System.Text.ASCIIEncoding.ASCII.GetString(Convert.FromBase64String(readMe.Content));
            return(_mapper.Map <RepositoryViewModel>(source));;
        }
Ejemplo n.º 2
0
        public RepositoryItemResponse Item([FromBody] RepositoryItemRequest request)
        {
            RepositoryItemResponse response = new RepositoryItemResponse();

            if (request.Id <= 0)
            {
                response.Status = -1;
                return(response);
            }

            RepositoryEntity entity = repositoryRepository.GetById(request.Id);

            if (entity == null)
            {
                response.Status = 404;
                return(response);
            }

            response.Item = repositoryConvertor.toLessVo(entity);

            response.Status = 1;
            return(response);
        }