public IActionResult Delete(IssueStateCommentDto issueDTO)
        {
            var result = _issueStateCommentService.Delete(issueDTO);

            switch (result)
            {
            case 200:
                return(Ok());

                break;

            case 404:
                return(NotFound("Nu este niciun issue state comment cu id -ul dat"));

                break;

            case 500:
                return(StatusCode(500, "Issue state comment-ul se afla in bd, dar nu a putut fi sters"));

                break;

            default:
                return(StatusCode(500, null));
            }
        }
Exemple #2
0
        public IssueStateCommentDto Create(IssueStateCommentDto issueDTO)
        {
            var issue = _mapper.Map <IssueStateComment>(issueDTO);

            _issueStateCommentRepository.Create(issue);
            _issueStateCommentRepository.SaveChanges();
            return(_mapper.Map <IssueStateCommentDto>(_issueStateCommentRepository.GetWithDetails(issue.Id)));
        }
        public IActionResult Update(IssueStateCommentDto issueDTO)
        {
            var updatedIssue = _issueStateCommentService.Update(issueDTO);

            if (updatedIssue == null)
            {
                return(StatusCode(500));
            }

            return(Ok(updatedIssue));
        }
        public IActionResult Create(IssueStateCommentDto issueDTO)
        {
            var createdIssueComment = _issueStateCommentService.Create(issueDTO);

            if (createdIssueComment == null)
            {
                return(StatusCode(500));
            }

            return(Ok(createdIssueComment));
        }
Exemple #5
0
 public IssueStateCommentDto Update(IssueStateCommentDto issueDTO)
 {
     if (_issueStateCommentRepository.FindById(issueDTO.Id) == null)
     {
         return(null);
     }
     else
     {
         _issueStateCommentRepository.Update(_mapper.Map <IssueStateComment>(issueDTO));
         _issueStateCommentRepository.SaveChanges();
         return(_mapper.Map <IssueStateCommentDto>(_issueStateCommentRepository.GetWithDetails(issueDTO.Id)));
     }
 }
Exemple #6
0
        public int Delete(IssueStateCommentDto issueDTO)
        {
            if (_issueStateCommentRepository.FindById(issueDTO.Id) == null)
            {
                return(404);
            }
            else
            {
                _issueStateCommentRepository.Delete(_mapper.Map <IssueStateComment>(issueDTO));
                _issueStateCommentRepository.SaveChanges();

                if (_issueStateCommentRepository.FindById(issueDTO.Id) == null)
                {
                    return(200);
                }
                else
                {
                    return(500);
                }
            }
        }