Example #1
0
        public JsonResult MakeComment(string email, string content)
        {
            var ret = new CourseOperatorResp
            {
                Status = 0,
                Msg    = "评论成功!"
            };

            if (!Authority())
            {
                ret.Status = 1;
                ret.Msg    = @"请先登录!";
                return(Json(ret));
            }

            if (string.IsNullOrEmpty(email) || string.IsNullOrEmpty(content))
            {
                ret.Status = 2;
                ret.Msg    = @"";
                return(Json(ret));
            }

            var model = new TeacherService.TeacherCommentView()
            {
                Teacher = email,
                Content = content,
                Email   = Request.Cookies.Get(DefaultAuthenticationTypes.ApplicationCookie).Value,
                PubDate = DateTime.Now,
                Floor   = teacherClient.GetValidFloor(email)
            };

            teacherClient.AddComment(model);
            return(Json(ret));
        }
Example #2
0
 public TeacherCommentViewModel(TeacherService.TeacherCommentView model)
 {
     this.Id      = model.Id;
     this.Code    = model.Email;
     this.Date    = model.PubDate;
     this.Content = model.Content;
     this.Floor   = model.Floor;
 }