예제 #1
0
        public async Task <string> Handle(RemoveNewsCommand request, CancellationToken cancellationToken)
        {
            var news = _content.Newses.Where(n => n.id == request.Id).FirstOrDefault(); //get news by id

            _content.Remove(news);                                                      // remove this news
            _content.SaveChanges();
            return(await Task.FromResult(request.Id + "  delete"));
        }
예제 #2
0
        public async Task <string> Handle(RemoveCommentsCommand request, CancellationToken cancellationToken)
        {
            var result = _content.Comment.Where(c => c.id == request.Id).FirstOrDefault(); //get comment by id

            _content.Remove(result);                                                       // remove this news
            _content.SaveChanges();
            return(await Task.FromResult(request.Id + "delete"));
        }