public JsonDocument SetBxUser([FromBody] newBxUser newBxUser) { if (!authUser.is_admin) { return(throwError("თქვენ არ გაქვთ ამ ოპერაციის განხორციელების უფლება")); } if (string.IsNullOrWhiteSpace(newBxUser.refreshToken)) { return(throwError("შეავსეთ შიფრის ველი.")); } if (!string.IsNullOrWhiteSpace(newBxUser.email) && !string.IsNullOrWhiteSpace(newBxUser.password) && !string.IsNullOrWhiteSpace(newBxUser.antsEmail)) { var newBxUserID = 0; var http = new HttpClient(); var responseMessage = http.GetAsync(new BXManager().bxRestUrl + "profile?auth=" + newBxUser.accessToken).Result; if (responseMessage.StatusCode == HttpStatusCode.OK) { var res = responseMessage.Content.ReadAsStringAsync(); newBxUserID = Convert.ToInt32(JsonDocument.Parse(res.Result.ToString()).RootElement.GetProperty("result").GetProperty("ID").ToString()); } if (newBxUserID == 0) { return(throwError("ბიტრიქსის UserID ვერ დადგინდა.")); } var x = new PKG_USERS().setBxUser(newBxUser.email, newBxUser.password, newBxUser.antsEmail, newBxUser.refreshToken, Convert.ToInt32(newBxUserID)); return(Success(x)); } else { return(throwError("შეავსეთ ყველა ველი")); } }
public JsonDocument DeleteBxUser([FromBody] newBxUser newBxUser) { if (!authUser.is_admin) { return(throwError("თქვენ არ გაქვთ ამ ოპერაციის განხორციელების უფლება")); } if (newBxUser.antsUserID > 0) { var x = new PKG_USERS().deleteBxUser(newBxUser.antsUserID, authUser.ID); return(Success(x)); } else { return(throwError("შეავსეთ მეილის(Ants UserID) ველი")); } }