public async Task SaveData(Base_User theData, string newPwd, string roleIdsJson) { if (!newPwd.IsNullOrEmpty()) { theData.Password = newPwd.ToMD5String(); } var roleIds = roleIdsJson?.ToList <string>() ?? new List <string>(); if (theData.Id.IsNullOrEmpty()) { theData.InitEntity(); await _userBus.AddDataAsync(theData, roleIds); } else { await _userBus.UpdateDataAsync(theData, roleIds); } }
public ActionResult <AjaxResult> SaveData(Base_User theData, string newPwd, string roleIdsJson) { AjaxResult res; if (!newPwd.IsNullOrEmpty()) { theData.Password = newPwd.ToMD5String(); } var roleIds = roleIdsJson?.ToList <string>() ?? new List <string>(); if (theData.Id.IsNullOrEmpty()) { theData.InitEntity(); res = _userBus.AddData(theData, roleIds); } else { res = _userBus.UpdateData(theData, roleIds); } return(JsonContent(res.ToJson())); }