zoukankan      html  css  js  c++  java
  • 一沙框架(yishaadmin)在后台保存或修改数据之前修改某个字段值的方法

    一沙框架(yishaadmin)在后台保存或修改数据之前修改某个字段值的方法

    1、在controller中

    1 [HttpPost]
    2    [AuthorizeFilter("device:devicetype:add,device:devicetype:edit")]
    3    public async Task<ActionResult> SaveFormJson(DeviceTypeEntity entity)
    4    {
    5      entity.F_MaterialType = 1;//物料类型:1-设备 2-部件
    6      TData<string> obj = await deviceTypeBLL.SaveForm(entity);
    7      return Json(obj);
    8    }          

    2、在BLL中

     1 [HttpPost]
     2         public async Task<TData<OperatorInfo>> Login([FromQuery] string userName, [FromQuery] string password, [FromQuery] string myCid)
     3         {
     4             TData<OperatorInfo> obj = new TData<OperatorInfo>();
     5             TData<UserEntity> userObj = await userBLL.CheckLogin(userName, password, (int)PlatformEnum.WebApi);
     6             if (userObj.Tag == 1)
     7             {
     8                 userObj.Data.ClientId = myCid;//修改字段ClientId的值为myCid
     9                 await new UserBLL().UpdateUser(userObj.Data);
    10                 await Operator.Instance.AddCurrent(userObj.Data.ApiToken);
    11                 obj.Data = await Operator.Instance.Current(userObj.Data.ApiToken);
    12             }
    13             obj.Tag = userObj.Tag;
    14             obj.Message = userObj.Message;
    15             return obj;
    16         }

      

  • 相关阅读:
    Sky中国War3的旗帜
    2008流行趋势发布暨07届学生毕业秀(上海大学主办)
    随便写一下
    六一节——小朋友们快乐
    HEI
    Update my blog to improve my idea.
    由ipod引起的奇遇记
    加勒比海盗
    “老板娘”请客吃饭
    蚂蚁工坊
  • 原文地址:https://www.cnblogs.com/wishit/p/13446272.html
Copyright © 2011-2022 走看看