public ActionResult <Users> Put(int id, UsersUpdate modifyUser) { //var currentUser = HttpContext.User; //var nameid = Convert.ToInt32(currentUser.Claims.FirstOrDefault(e => e.Type == ClaimTypes.NameIdentifier).Value); //if (nameid == id) //{ Users moduser = users.GetUsers(id); moduser.name = modifyUser.name; moduser.email = modifyUser.email; return(users.UpdateUser(id, moduser)); //} //var errorLog = new Error() //{ // Code = "400", // Message = $"You're not allowed to edit this id({id})!" //}; //return BadRequest(errorLog); }
// 公用静态方法,修改一条记录 UpdateUsers public static bool UpdateEntity(UsersBusEntity obj) { if (obj == null || obj.IsEmpty) { return(false); } UsersUpdate exec = new UsersUpdate(); try { exec.ReceiveParameter(obj); exec.ExecNoQuery(); return(true); } catch (Exception ex) { //throw ex; return(false); } finally { obj = null; } }
// 公用静态方法,修改一条记录 UpdateUsers public static bool UpdateEntity(UsersBusEntity obj) { if (obj == null || obj.IsEmpty) { return false; } UsersUpdate exec = new UsersUpdate(); try { exec.ReceiveParameter(obj); exec.ExecNoQuery(); return true; } catch (Exception ex) { //throw ex; return false; } finally { obj = null; } }