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); }
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); }
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); }