Ejemplo n.º 1
0
        public static dto_Topic GetTopic(int Id)
        {
            dto_Topic model = null;

            using (MySqlDataReader dr = MySqlHelper.ExecuteReader(Util.GetConnectString(BBSConnString),
                                                                  "select Id, UserId, Invites, Title, TopicContent, TopicText, CreateDate, Good, Hit, ReplyCount, GradeId, SubjectId, Deleted, Blocked, Ip from T_Topic where Id = @Id",
                                                                  "@Id".ToInt32InPara(Id)))
            {
                if (dr != null && dr.HasRows)
                {
                    model = MySqlDBHelper.ConvertDataReaderToEntitySingle <dto_Topic>(dr);
                }
            }
            return(model);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 查看详情
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        public ActionResult detail(int id)
        {
            dto_Topic t = B_Topic.GetTopic(id);

            if (t != null)
            {
                T_User u = B_UserRedis.GetUser(t.UserId);
                t.UserName = u == null ? "" : u.UserName;
                t.TrueName = u == null ? "" : u.TrueName;
                string GradeName = "", SubjectName = "";
                Const.Grades.TryGetValue(t.GradeId, out GradeName);
                Const.Subjects.TryGetValue(t.SubjectId, out SubjectName);
                t.GradeName   = GradeName;
                t.SubjectName = SubjectName;
            }
            ViewBag.TopicInfo = t;
            return(View());
        }