public async Task <IActionResult> ShowPlaceComments([FromBody] GetPlaceCommentsInputDto getinput)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest());
            }
            var result = await CommentServise.ShowPlaceComments(getinput);

            return(Ok(result));
        }
Exemplo n.º 2
0
        public Task <List <GetPlacecommentsOutputDto> > ShowPlaceComments(GetPlaceCommentsInputDto getinput)
        {
            FindPlace(getinput.TuristPlaceName);
            var comments = CommentRepository.GetQuery()
                           .Include(c => c.User)
                           .Include(c => c.TuristPlace)
                           .Where(c => c.TuristPlace.Name == getinput.TuristPlaceName)
                           .Select(c => mapper.Map <GetPlacecommentsOutputDto>(c))
                           .ToListAsync();

            if (comments == null)
            {
                throw new KeyNotFoundException("not found any comment");
            }
            return(comments);
        }