Exemplo n.º 1
0
        public JsonResult MakeComment(string code, string content)
        {
            var ret = new CourseOperatorResp
            {
                Status = 0,
            };

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

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

            var model = new CourseCommentService.CourseCommentView()
            {
                Code    = code,
                Content = content,
                Email   = Request.Cookies.Get(DefaultAuthenticationTypes.ApplicationCookie).Value,
                PubDate = DateTime.Now,
                Floor   = courseCommentClient.GetValidFloor(code)
            };

            courseCommentClient.AddComment(model);
            return(Json(ret));
        }
Exemplo n.º 2
0
 public CourseCommentViewModel(CourseCommentService.CourseCommentView model)
 {
     this.Id      = model.Id;
     this.Code    = model.Code;
     this.Date    = model.PubDate;
     this.Content = model.Content;
     this.Floor   = model.Floor;
 }