Ejemplo n.º 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();
            }
        }
Ejemplo n.º 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);
 }
Ejemplo n.º 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();

            }
        }