예제 #1
0
        public ActionResult AddSection(SectionCreatePageView sectionCreatePageView)
        {
            try
            {
                var request = new AddSectionRequest
                              	{
                                    ArticleId=sectionCreatePageView.ArticleView.Id,
                                    ArticleName=sectionCreatePageView.ArticleView.Name,
                                    SectionId=sectionCreatePageView.SectionView.Id==Guid.Empty?Guid.NewGuid():sectionCreatePageView.SectionView.Id,
                                    SectionName =sectionCreatePageView.SectionView.Name,
                                    Content=sectionCreatePageView.SectionView.Content
                              	};
                var response=new AddSectionResponse();
                if(sectionCreatePageView.SectionView.Id==Guid.Empty)
                {
                    response = _articleService.AddSection(request);
                }
                else
                {
                    response = _articleService.EditSection(request);
                }

                return RedirectToAction("AddSection", new {name=response.ArticleName});
            }
            catch (Exception)
            {
                throw new NotImplementedException();
            }
        }
예제 #2
0
 public ActionResult AddSection(string name)
 {
     var request = new GetSectionsByArticleRequest { Name = name };
         var response = _articleService.GetSectionsByArticle(request);
         var articlePageView = new SectionCreatePageView
                               	{
                               		ArticleView = response.Article,
                                     SectionsView=response.Sections,
                                     SectionView=new SectionView()
                               	};
         return View(articlePageView);
 }
예제 #3
0
        public ActionResult EditSection(SectionCreatePageView sectionCreatePageView)
        {
            try
            {
                var request = new AddSectionRequest
                                  {
                                      ArticleId = sectionCreatePageView.ArticleView.Id,
                                      ArticleName = sectionCreatePageView.ArticleView.Name,
                                      SectionId = sectionCreatePageView.SectionView.Id,
                                      SectionName = sectionCreatePageView.SectionView.Name,
                                      Content = HttpUtility.HtmlEncode(sectionCreatePageView.SectionView.Content)
                                  };
                var response = _articleService.EditSection(request);

                return RedirectToAction("AddSection", new {name = response.ArticleName});
            }
            catch (Exception)
            {
                throw new NotImplementedException();

            }
        }