示例#1
0
 public AddSectionResponse EditSection(AddSectionRequest request)
 {
     var response = new AddSectionResponse();
     var section = new Section
                       {
                           ArticleId = request.ArticleId,
                           SectionId = request.SectionId,
                           Name = request.SectionName,
                           ContentInformation = request.Content
                       };
     _sectionRepository.Save(section);
     _unitOfWork.Commit();
     var sections = _sectionRepository.FindByArticle(section.ArticleId);
     response.SectionView = sections.ConvertToSectionViews();
     response.ArticleName = request.ArticleName;
     return response;
 }
示例#2
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();
            }
        }
示例#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();

            }
        }