예제 #1
0
        public async Task <UserEntity> DeleteAsync(Guid id)
        {
            var user = _getableUser.GetById(id);

            await _userRepository.DeleteAsync(id);

            return(user);
        }
        public IEnumerable <PublicationEntity> GetPublicationsWithFavorites(Guid authorId)
        {
            var author = _getableUser.GetById(authorId);

            CheckAuthorFavorites(author);
            return(author.Favorites);
        }
예제 #3
0
        public FavoriteResultDTO LikeOrUnlike(FavoriteDTO favoriteDTO)
        {
            var author      = _getableUser.GetById(favoriteDTO.UserId);
            var publication = _getablePublication.GetById(favoriteDTO.PublicationId);
            var result      = InitFavorite(publication, author);

            result.IsLike = LikeOrUnlike(author, publication);
            return(result);
        }
예제 #4
0
        public ActionResult <UserDTO> Get(Guid id)
        {
            try
            {
                var userEntity = _getableUser.GetById(id);

                var userDTO = _mapper.Map <UserDTO>(userEntity);

                return(Ok(userDTO));
            }
            catch (ObjectNotFoundException ex)
            {
                return(NotFound(ex.Message));
            }
        }
 private void CheckAuthorIsValid(Guid id)
 {
     _getableUser.GetById(id);
 }