Beispiel #1
0
        /// <summary>
        /// 修改
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        // PUT: api/Admin
        public async Task <IHttpActionResult> Put([FromBody] Admin value)
        {
            try
            {
                SqlUpdate <Admin> sql    = new SqlUpdate <Admin>();
                string            sqlStr = sql.GetUpdateSql(value, value.Id.ToString());
                bool f = await bll.SqlGet(sqlStr);

                if (f)
                {
                    return(this.JsonMy(new AjaxResult <Admin> {
                        Code = 1, Msg = ""
                    }));
                }
                else
                {
                    return(this.JsonMy(new AjaxResult <Admin> {
                        Code = 0, Msg = "请求失败"
                    }));
                }
            }
            catch (Exception e)
            {
                var msg = "请求失败";
#if DEBUG
                msg = e.Message;
#endif
                return(this.JsonMy(new AjaxResult <Admin> {
                    Code = 0, Msg = msg
                }));
            }
        }