Пример #1
0
        public void TestDeleteOk()
        {
            var result = _mockRepo.Delete(7);

            Assert.IsTrue(result.Result);
            var search = _mockRepo.GetById(7);

            Assert.IsNull(search);
            var count = _articles.Count();

            Assert.AreEqual(7, count);
        }
Пример #2
0
        public HttpResponseMessage Delete(DeleteDTO dto)
        {
            var cat = _repository.Get(dto.articleId, ActiveModule.ModuleID);

            _repository.Delete(cat);

            return(Request.CreateResponse(System.Net.HttpStatusCode.NoContent));
        }
Пример #3
0
            public async Task <Unit> Handle(DeleteArticleCommand request, CancellationToken cancellationToken)
            {
                var article = await _articleRepo.GetById(request.Id, cancellationToken);

                if (article == null)
                {
                    throw new NotFoundException(nameof(Article), request.Id);
                }
                await _articleRepo.Delete(article.Id, cancellationToken);

                return(Unit.Value);
            }