示例#1
0
        /// <summary>
        /// 提案詳細頁之聯繫提案者的API
        /// </summary>
        /// <param name="commentVM"></param>
        /// <returns></returns>
        //[System.Web.Mvc.HttpPost]
        public string UpdateComment([FromBody] CommentViewModel commentVM)
        {
            var session = System.Web.HttpContext.Current.Session;

            var member = (MemberViewModel)session["Member"];

            if (member == null)
            {
                return("login");
            }
            else if (commentVM.Comment_Question == null)
            {
                return("try");
            }
            else
            {
                commentVM.MemberId = member.MemberId;
                string queryProjectMemberId = _commentService.CheckProjectMemberId(commentVM);
                if (queryProjectMemberId == "Same")
                {
                    return("Same");
                }

                commentVM.Comment_Time = DateTime.UtcNow.AddHours(8);
                var result = _commentService.CreateANewComment(commentVM);
                if (result == "success")
                {
                    return("ok");
                }
                else
                {
                    return("fail");
                }
            }
        }