public ActionResult Edit([Bind(Include = "id,teaser,headline,subtitle,byline,lead,content,credit,authorid,leadimage,leadcaption,leadcredit,date,createddate")] UpdateArticleDTO article)
 {
     if (ModelState.IsValid)
     {
         _articlesService.UpdateArticle(article);
         //_articlesService.Save(article);
         return(RedirectToAction("Index"));
     }
     else
     {
         return(View(article));
     }
 }
Ejemplo n.º 2
0
        //public void Save(GetArticleDTO articleDTO)
        //{
        //    Article article = new Article()
        //    {
        //        teaser = articleDTO.teaser,
        //        headline = articleDTO.headline,
        //        subtitle = articleDTO.subtitle,
        //        byline = articleDTO.byline,
        //        lead = articleDTO.lead,
        //        content = articleDTO.content,
        //        credit = articleDTO.credit,
        //        authorid = articleDTO.authorid,
        //        leadimage = articleDTO.leadimage,
        //        leadcaption = articleDTO.leadcaption,
        //        leadcredit = articleDTO.leadcredit,
        //        date = articleDTO.date,
        //        createddate = articleDTO.createddate
        //    };
        //    _articleRepository.Save(article);
        //}

        public void UpdateArticle(UpdateArticleDTO articleDTO)
        {
            Article article = new Article()
            {
                id          = articleDTO.id,
                teaser      = articleDTO.teaser,
                headline    = articleDTO.headline,
                subtitle    = articleDTO.subtitle,
                byline      = articleDTO.byline,
                lead        = articleDTO.lead,
                content     = articleDTO.content,
                credit      = articleDTO.credit,
                authorId    = articleDTO.authorid,
                leadImage   = articleDTO.leadimage,
                leadcaption = articleDTO.leadcaption,
                leadcredit  = articleDTO.leadcredit,
                date        = articleDTO.date,
                createddate = articleDTO.createddate
            };

            _articleRepository.Update(article);
        }