Example #1
0
        /// <summary>
        /// 保存评价
        /// </summary>
        /// <param name="rm">评价信息</param>
        /// <param name="db"></param>
        /// <returns></returns>
        public bool insertScore(ResourceModel rm, JSZX_ResourceEntities db)
        {
            try
            {
                T_Res_Score score = new T_Res_Score();
                score.ID         = Guid.NewGuid().ToString();
                score.RES_ID     = rm.Id;
                score.APPEND_ID  = rm.AppId;
                score.GRADE      = Convert.ToDecimal(rm.Grade);
                score.REVIEW     = rm.Review;
                score.CREATEID   = rm.UserId;
                score.CREATETIME = DateTime.Now;

                db.T_Res_Score.Add(score);

                AddReviewNum(rm.Id, rm.AppId, Convert.ToDouble(rm.Grade), rm.UserId, db);

                db.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                clsLog.ErrorLog("Resource", "insertScore", ex.Message);
                return(false);
            }
        }
Example #2
0
        /// <summary>
        /// 删除评论
        /// </summary>
        /// <param name="id"></param>
        /// <param name="db"></param>
        /// <returns></returns>
        public Boolean deleteScore(string id, JSZX_ResourceEntities db)
        {
            try
            {
                T_Res_Score qa = db.T_Res_Score.First(t => t.ID == id);

                db.T_Res_Score.Remove(qa);

                db.SaveChanges();

                return(true);
            }
            catch (Exception ex)
            {
                clsLog.ErrorLog("Resource", "deleteScore", ex.Message);
                return(false);
            }
        }