示例#1
0
        public IActionResult SaveUserPrice([FromBody] JObject obj)
        {
            var str       = obj["postJson"].ToString();
            var priceList = JsonConvert.DeserializeObject <List <JsonUprice> >(str);

            if (priceList != null)
            {
                List <Userprice> list = new List <Userprice>();
                foreach (var item in priceList)
                {
                    Userprice userprice = new Userprice()
                    {
                        Userid    = item.Userid,
                        Channelid = item.Channelid,
                        Uprice    = item.Userid,
                        Gprice    = item.Gprice,
                        Is_state  = item.Is_state,
                        Addtime   = DateTime.Now
                    };
                    list.Add(userprice);
                }
                var res = _usersSvc.InsertUpriceList(list, this.UserId);
                if (res.IsSuccess)
                {
                    this.ResponseResult.Result  = 1;
                    this.ResponseResult.Message = res.Message;
                    this.ResponseResult.Data    = "Users/User/Index";
                }
                else
                {
                    this.ResponseResult.Result  = 0;
                    this.ResponseResult.Message = res.Message;
                    this.ResponseResult.Data    = "Users/User/Index";
                }
            }
            else
            {
                this.ResponseResult.Result  = 0;
                this.ResponseResult.Message = "更新失败";
                this.ResponseResult.Data    = "Users/User/Index";
            }
            return(Json(this.ResponseResult));
        }