public static async Task <bool> Loginx(RequestUsersModel req) { ApiResponse <ModelUsers> ApiResponse = new ApiResponse <ModelUsers>(); ModelUsers modelUser = new ModelUsers(); try { var stringJSON = await Task.Run(() => JsonConvert.SerializeObject(req)); JObject jsonResult = await ApiQueryX("LoginCheck", stringJSON); if (jsonResult != null) // hata alınmamışsa { var jsonData = jsonResult["Result"]; var jsonDataError = jsonResult["Error"]; ApiResponse.Success = jsonResult["Success"].Value <bool>(); //ApiResponse.ErrorCode = jsonDataError["ErrorCode"].Value<string>(); //ApiResponse.ErrorMessage = jsonDataError["Message"].Value<string>(); foreach (var i in jsonData) { modelUser.id = i["id"].Value <int>(); modelUser.username = i["username"].Value <string>(); modelUser.password = i["password"].Value <string>(); modelUser.email = i["email"].Value <string>(); modelUser.phone = i["phone"].Value <string>(); modelUser.ipadress = i["ipadress"].Value <string>(); modelUser.name = i["name"].Value <string>(); modelUser.surname = i["surname"].Value <string>(); modelUser.birthday = i["birthday"].Value <DateTime>(); } } } catch (Exception ex) { // ignored } App.Instance.usersModel = modelUser; return(ApiResponse.Success); }
public static async Task <bool> UserUpdate(ModelUsers req) { ApiResponse <ModelUsers> ApiResponse = new ApiResponse <ModelUsers>(); try { var stringJSON = await Task.Run(() => JsonConvert.SerializeObject(req)); JObject jsonResult = await ApiQueryX("UserUpdate", stringJSON); if (jsonResult != null) // hata alınmamışsa { ApiResponse.Success = jsonResult["Success"].Value <bool>(); } } catch (Exception ex) { // ignored } return(ApiResponse.Success); }
public static async Task <ApiResponse <ModelUsers> > ForgotPass(ModelUsers req) { ApiResponse <ModelUsers> ApiResponse = new ApiResponse <ModelUsers>(); ModelUsers modelUser = new ModelUsers(); try { var stringJSON = await Task.Run(() => JsonConvert.SerializeObject(req)); JObject jsonResult = await ApiQueryX("ForgotPass", stringJSON); if (jsonResult != null) // hata alınmamışsa { var jsonData = jsonResult["Result"]; var jsonDataError = jsonResult["Error"]; ApiResponse.Success = jsonResult["Success"].Value <bool>(); //ApiResponse.ErrorCode = jsonDataError["ErrorCode"].Value<string>(); //ApiResponse.ErrorMessage = jsonDataError["Message"].Value<string>(); foreach (var i in jsonData) { modelUser.password = i["password"].Value <string>(); modelUser.email = i["email"].Value <string>(); } ApiResponse.Data = modelUser; } } catch (Exception ex) { // ignored } return(ApiResponse); }