示例#1
0
        public ActionResult GetUserNotReceiveNotice(int?userId, string jsoncallback = "")
        {
            try
            {
                if (userId == 0 || !userId.HasValue)
                {
                    return(Content(JsonConvert.SerializeObject(new
                    {
                        Code = -400,
                        Msg = "参数错误"
                    })));
                }

                List <NoticeReceiverItemVM> list = new NoticeReceiverService().GetUserNotReceiveNotice(userId.Value);
                var json = JsonConvert.SerializeObject(new
                {
                    Code = 200,
                    Msg  = "获取成功",
                    Data = list
                });

                if (!string.IsNullOrEmpty(jsoncallback))
                {
                    json = jsoncallback + "(" + json + ")";
                }

                return(Content(json, "text/plain", System.Text.Encoding.UTF8));
            }
            catch (Exception ex)
            {
                LogHelper.WriteLog(ex.Message);
                throw ex;
            }
        }
示例#2
0
        public ActionResult GetUserNotReceiveNotice(int userId, string jsoncallback = "")
        {
            List<NoticeReceiverItemVM> list = new NoticeReceiverService().GetUserNotReceiveNotice(userId);
            var json = JsonConvert.SerializeObject(new
            {
                code = 0,
                data = list
            });

            if (!string.IsNullOrWhiteSpace(jsoncallback))
            {
                json = jsoncallback + "(" + json + ")";
            }

            return Content(json, "text/plain", System.Text.Encoding.UTF8);
        }