Example #1
0
        public JsonResult EditMessage(Message model)
        {
            try
            {
                model.UserID   = GetLoginUser.RecordID;
                model.UserName = GetLoginUser.UserName;
                if (string.IsNullOrWhiteSpace(model.RecordID))
                {
                    model.UserID   = GetLoginUser.RecordID;
                    model.UserName = GetLoginUser.UserName;
                    bool result = MessageServices.Add(model);
                    if (!result)
                    {
                        throw new MyException("保存失败");
                    }
                }
                else
                {
                    bool result = MessageServices.Update(model);
                    if (!result)
                    {
                        throw new MyException("保存失败");
                    }
                }


                return(Json(MyResult.Success()));
            }
            catch (MyException ex)
            {
                return(Json(MyResult.Error(ex.Message)));
            }
            catch (Exception ex)
            {
                ExceptionsServices.AddExceptions(ex, "保存黑名单信息失败");
                return(Json(MyResult.Error("保存失败")));
            }
        }