Exemple #1
0
        public AddArticleResponse AddArticle(AddArticleRequest request)
        {
            var response = new AddArticleResponse();
            var article = new Article {ArticleId = request.ArticleId, Name = request.Name, Description = request.Description};

            _articleRepository.Add(article);
            _unitOfWork.Commit();

            response.ArticleView = article.ConvertToArticleView();
            return response;
        }
Exemple #2
0
        public ActionResult AddArticle(ArticleSummaryPageView articleSummaryPageView)
        {
            try
            {
                var request = new AddArticleRequest
                              	{
                              		ArticleId =articleSummaryPageView.Article.Id==Guid.Empty?Guid.NewGuid():articleSummaryPageView.Article.Id,
                              		Name = articleSummaryPageView.Article.Name,
                                    Description = articleSummaryPageView.Article.Description,
                                };

                var response = articleSummaryPageView.Article.Id == Guid.Empty ? _articleService.AddArticle(request) : _articleService.EditArticle(request);
                return RedirectToAction("AddSection", "Article", new {response.ArticleView.Name});
            }
            catch (ArticleInvalidException)
            {
                //ToDo Handle ArticleInvalidException
                throw new NotImplementedException();
            }
        }
Exemple #3
0
        public ActionResult AddArticle(ArticleCreatePageView articleCreatePageView)
        {
            try
            {
                var request = new AddArticleRequest
                {
                    ArticleId = Guid.NewGuid(),
                    Name = articleCreatePageView.Article.Name,
                    Description = articleCreatePageView.Article.Description
                };

                var response = _articleService.AddArticle(request);

                return RedirectToAction("AddSection", "Article", new {area="Administration",articleId = response.ArticleView.Id});
            }
            catch (ArticleInvalidException)
            {
                //ToDo Handle ArticleInvalidException
                throw new NotImplementedException();
            }
        }