Exemplo n.º 1
0
        public async Task <IHttpActionResult> Delete(int commentId)
        {
            try
            {
                var comment = _repo.GetCommentById(commentId);
                if (comment == null)
                {
                    return(NotFound());
                }

                _repo.DeleteComment(commentId);
                if (await _repo.SaveChangesAsync())
                {
                    return(Ok());
                }
                else
                {
                    return(InternalServerError());
                }
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }