Exemple #1
0
        public async Task <IActionResult> CreatePostComment([FromBody] PostComment model)
        {
            try
            {
                model.Id = Guid.NewGuid();
                return(Ok(await _commentForPostService.CommentPost(model)));
            }
            catch (Exception e)
            {
                if (e is PostNotFoundException)
                {
                    return(NotFound(e.Message));
                }

                if (e is UserNotFoundException)
                {
                    return(NotFound(e.Message));
                }

                return(BadRequest(e.Message));
            }
        }