public async Task <Entities.Concrete.Article> AddArticle(ArticleAddForDto articleAddForDto) { var article = _mapper.Map <Article.Entities.Concrete.Article>(articleAddForDto); var articleValidator = new ArticleValidator(); var resutltValidator = articleValidator.Validate(article); if (resutltValidator.Errors.Count > 0) { throw new ValidationException(resutltValidator.Errors); } var addedArticle = await _articleDal.AddAsync(article); return(addedArticle); }
public async Task <IActionResult> Post([FromBody] ArticleAddForDto articleAddForDto) { var addedArticle = await _articleService.AddArticle(articleAddForDto); return(Ok(addedArticle)); }