コード例 #1
0
ファイル: ArticleService.cs プロジェクト: HaoTan/RAD
 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
ファイル: ArticleController.cs プロジェクト: HaoTan/RAD
        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
ファイル: ArticleController.cs プロジェクト: HaoTan/RAD
        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();

            }
        }