Exemple #1
0
        public int Like(string id)
        {
            tb_Article articleModel = new tb_Article();

            articleModel = ArticleBll.getModel(p => p.Id == id);
            articleModel.LikeNum++;
            return(ArticleBll.Edit(articleModel)?1:0);
        }
Exemple #2
0
        /// <summary>
        /// 详情页
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult Detailed(string id)
        {
            tb_Article articleModel = new tb_Article();

            articleModel = ArticleBll.getModel(p => p.Id == id);
            articleModel.ReadNum++;
            ArticleBll.Edit(articleModel);
            view_Article article = new view_Article();

            article = vArticleBll.getModel(p => p.Id == id);
            return(View(article));
        }
Exemple #3
0
 public int Save(tb_Article article)
 {
     try
     {
         if (article != null)
         {
             article.Id   = Guid.NewGuid().ToString();
             article.Date = DateTime.Now;
             if (ArticleBll.Save(article))
             {
                 return(1);
             }
         }
         return(0);
     }
     catch (Exception e)
     {
         throw e;
     }
 }
Exemple #4
0
 /// <summary>
 /// 添加文章信息
 /// </summary>
 /// <param name="context"></param>
 public void AddArticle(HttpContext context)
 {
     try
     {
         tb_Article objModel = new tb_Article();
         objModel.Title       = context.Request.Form["Title"].ToString().Trim();
         objModel.Author      = context.Request.Form["Author"].ToString().Trim();
         objModel.InfoType    = context.Request["articleType"].ToString().Trim();
         objModel.PublishTime = Convert.ToDateTime(System.DateTime.Now.ToString());
         objModel.InfoSummary = context.Request.Form["InfoSummary"].ToString().Trim();
         objModel.InfoContent = context.Request["Article"].ToString().Trim();
         objModel.HitCount    = 0;
         ldc.tb_Article.InsertOnSubmit(objModel);
         ldc.SubmitChanges();
         context.Response.Write("Succ");
         return;
     }
     catch (Exception ex)
     {
         context.Response.Write("error");
     }
 }