Beispiel #1
0
        /// <summary>
        /// 提交课程评论
        /// </summary>
        /// <param name="request"></param>
        /// <returns></returns>
        public SubmitCourseCommentResponse SubmitCourseComment(SubmitCourseCommentRequest request)
        {
            var result = new SubmitCourseCommentResponse()
            {
                Result        = true,
                ResultMessage = "提交课程评论成功"
            };

            try
            {
                //var courseComment = new coursecomment()
                //{
                //    UserID = request.UserID,
                //    CourseNumber = request.CourseNumber,
                //    CourseBookingID = request.CourseBookingID,
                //    CoachNumber = request.CoachNumber,
                //    CoachComment = request.CoachComment,
                //    CommentDate = DateTime.Now,
                //    DataChange_CreateTime = DateTime.Now,
                //    DataChange_LastTime = DateTime.Now
                //};

                //db.coursecomments.Add(courseComment);
                //db.SaveChanges();
            }
            catch (Exception ex)
            {
                result.Result        = false;
                result.ResultMessage = "提交课程评论异常";
                result.Errors.Add(ex.Message);
            }

            return(result);
        }
Beispiel #2
0
        public SubmitCourseCommentResponse SubmitCourseComment(SubmitCourseCommentRequest request)
        {
            var result = new SubmitCourseCommentResponse()
            {
                ResultMessage = "提交课程评论成功",
                Result        = ResultCode.Success
            };

            try
            {
                using (var con = new DbConnectionProvider(dbName).GetOpenConnection())
                {
                    var parms = new DynamicParameters();
                    parms.Add("P_UserID", request.UserID, DbType.Int32);
                    parms.Add("P_CourseBookingID", request.CourseBookingID, DbType.Int32);
                    parms.Add("P_Comment", request.Comment, DbType.String);

                    result.CommentID = con.ExecuteScalar <int>("sp_SubmitCourseComment"
                                                               , parms
                                                               , CommandType.StoredProcedure);
                }
            }
            catch (Exception ex)
            {
                result.ResultMessage = "提交课程评论异常";
                result.Result        = ResultCode.Error;
                result.Errors        = new List <string>();
                result.Errors.Add(ex.Message);
                LogHelper.WriteErrorLog(ex);
            }
            return(result);
        }