public void testDeleteComment()
        {
            Console.WriteLine("Delete comment...");

            //NE PAS OUBLIER DE SET L'ID !!!
            _comment.Id = 24;
            //--------------------------

            _bllManager.DeleteComment(_comment);
            Console.WriteLine("Apres Delete comment...");

            FullFilmDTO film = _bllManager.GetFullFilmDetailsByIdFilm(11);

            Console.WriteLine("Film : \n" + film.ToStringAll());

            CommentDTO commentFromBd = _bllManager.getCommentFromId(_comment.Id);

            if (commentFromBd == null)
            {
                Console.WriteLine("commentaire bien supprimé");
            }
            else
            {
                Console.WriteLine("commentaire pas supprimé : " + commentFromBd);
            }

            Assert.Pass();
        }
示例#2
0
        public IActionResult DeleteComment(int id)
        {
            ResponseSingleObject <CommentDTO> responseSingleObject = new ResponseSingleObject <CommentDTO>()
            {
                Status   = StatusCodes.Status404NotFound,
                Errors   = null,
                Message  = null,
                Succeded = false,
                Value    = null,
            };

            try
            {
                CommentDTO commentDto = _bllManager.getCommentFromId(id);
                _bllManager.DeleteComment(commentDto);
                return(Ok(commentDto));
            }
            catch (Exception e)
            {
                responseSingleObject.Errors =
                    "GetNumberCommentsFromTo() EXCEPTION : " + e.ToString();
            }

            return(StatusCode(responseSingleObject.Status, responseSingleObject));
        }