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