public ActionResult DeleteAccount(User u)
 {
     try
     {
         if (u.UserName.IsNullOrWhiteSpace())
         {
             u = _bLLUser.Fetch(ur => ur.UserId == u.UserId);
         }
         if (u == null)
         {
             return(Json(false));
         }
         if ("admin".EqualsIgnoreCase(u.UserName) || "Alice".EqualsIgnoreCase(u.UserName))
         {
             return(Json(false));
         }
         var count = _bLLUser.Delete(u);
         if (count == 1)
         {
             OperLogHelper.AddOperLog($"删除用户 {u.UserId:N} {u.UserName}", OperLogModule.Account, UserName);
             return(Json(true));
         }
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
     }
     return(Json(false));
 }
示例#2
0
 public ActionResult DeleteAccount(User u)
 {
     try
     {
         var count = _bLLUser.Delete(ur => ur.UserId == u.UserId);
         if (count == 1)
         {
             OperLogHelper.AddOperLog($"删除用户 {u.UserId.ToString("N")} {u.UserName}", OperLogModule.Account, Username);
             return(Json(true));
         }
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
     }
     return(Json(false));
 }