Esempio n. 1
0
 public ActionResult New(ArticleModel model)
 {
     if (ModelState.IsValid)
     {
         var article = new JL.Core.Models.Article();
         article.AddTime = model.AddTime ?? DateTime.Now;
         article.Content = model.Content;
         article.Brief   = model.Brief;
         article.Title   = model.Title;
         article.Status  = model.IsPublished ? 0 : 1;
         // picture
         if (Request.Files != null &&
             Request.Files.Count > 0)
         {
             var imgLink = FileHelper.SaveArticleImage(Request.Files[0]);
             article.Picture = imgLink;
         }
         jlService.AddArticle(article);
         ViewData.Add("ResultObject", ResultObject.Succeed());
     }
     return(View());
 }