Beispiel #1
0
 public void Process(NewArticleRequest newArticleRequest)
 {
     var articleToSave = _mapper.Map<Article>(newArticleRequest.Article);
     _commandRepository.CreateArticle(articleToSave);
 }
Beispiel #2
0
 public object Handle(NewArticleRequest newArticleRequest)
 {
     string[] validationErrors;
     if (!newArticleRequest.Article.Validate(out validationErrors, true))
     {
         throw new WebFaultException<WebFaultDto>(
             new WebFaultDto("Не удалось добавить статью", string.Join("\n", validationErrors)),
             HttpStatusCode.BadRequest);
     }
     _queue.PushMessage(newArticleRequest);
     return null;
 }