Beispiel #1
0
        /// <summary>
        /// 回复发表
        /// </summary>
        /// <returns></returns>
        public JsonResult AddFaBiaoInfo()
        {
            try
            {
                // TODO: Add delete logic here
                int ToUid = 0;
                if (!string.IsNullOrEmpty(Request.Form["Uid"]))
                {
                    ToUid = Convert.ToInt32(Request.Form["Uid"]);
                }
                string sContent = "";
                if (!string.IsNullOrEmpty(Request.Form["sContent"]))
                {
                    sContent = Request.Form["sContent"].ToString();
                }
                int ParentID = 0;
                if (!string.IsNullOrEmpty(Request.Form["parentID"]))
                {
                    ParentID = Convert.ToInt32(Request.Form["parentID"]);
                }
                using (EvaluatesServiceClient client = new EvaluatesServiceClient())
                {
                    ViewEvaluates model2 = client.GettEval(ToUid, sContent, user.Uid, ParentID);

                    if (model2 != null)
                    {
                        return(Json(new { code = 2 }));
                    }
                    else
                    {
                        ViewEvaluates model = new ViewEvaluates();
                        model.ToUid      = ToUid;
                        model.EContent   = sContent;
                        model.iShow      = 0;
                        model.iZan       = 0;
                        model.ParentID   = ParentID;
                        model.FromUid    = user.Uid;
                        model.CreateDate = DateTime.Now;
                        client.Add(model);

                        return(Json(new { code = 0 }));
                    }
                }
            }
            catch (Exception ex)
            {
                return(Json(new { code = ex.Message }));
            }
        }
Beispiel #2
0
        /// <summary>
        /// 添加评论
        /// </summary>
        /// <returns></returns>
        public JsonResult AddEvalInfo()
        {
            try
            {
                // TODO: Add delete logic here

                ViewEvaluates model      = new ViewEvaluates();
                string        strContent = Request.Form["sContent"].ToString();
                int           ToUid      = Convert.ToInt32(Request.Form["hidid"]);
                int           recomm     = Convert.ToInt32(Request.Form["recomm"]);
                int           FromUid    = user.Uid;

                using (EvaluatesServiceClient client = new EvaluatesServiceClient())
                {
                    model = client.GettEval(ToUid, strContent, FromUid);
                    if (model == null)
                    {
                        model            = new ViewEvaluates();
                        model.EContent   = FilterSpecial(strContent);
                        model.ToUid      = ToUid;
                        model.FromUid    = FromUid;
                        model.CreateDate = DateTime.Now;
                        model.ParentID   = 0;
                        model.iZan       = 0;
                        model.iShow      = 0;
                        model.Recommend  = recomm;
                        //相册
                        model.Pic = Request.Form["Diploma"];

                        int a = client.Add(model);
                        return(Json(new { code = 0 }));
                    }
                    else
                    {
                        return(Json(new { code = 2 }));//重复
                    }
                }
            }
            catch
            {
                return(Json(new { code = 1 }));
            }
        }