コード例 #1
0
ファイル: UserLogin.cs プロジェクト: yankazela/health-api
 public string Post([FromBody] AuthenticationService.loginRequest loginRequest) // user login
 {
     try
     {
         Task <AuthenticationService.loginResponse1> loginResponse1 = this.authPortClient.loginAsync(loginRequest);
         patientApi.Client         client  = new patientApi.Client(this.httpClient);
         Task <patientApi.Patient> patient = client.GetPatientAsync(loginResponse1.Result.loginResponse.token, loginResponse1.Result.loginResponse.userId);
         string healthPro = "";
         foreach (int healthProId in patient.Result.HealthProfessionalIds)
         {
             healthPro = healthPro + healthProId.ToString() + ",";
         }
         healthPro = healthPro.Length > 0 ? healthPro.Substring(0, healthPro.Length - 1) : healthPro;
         return("{'token': '" + loginResponse1.Result.loginResponse.token +
                "', 'userId': '" + loginResponse1.Result.loginResponse.userId.ToString() +
                "', 'username': '******', 'firstname': '" + patient.Result.FirstName +
                "', 'lastname': '" + patient.Result.LastName +
                "', 'dateOfBirth': '" + patient.Result.DateOfBirth +
                "', 'address': '" + patient.Result.Address +
                "', 'contactNumber': '" + patient.Result.ContactNumber +
                "', 'emailAddress': '" + patient.Result.EmailAddress +
                "', 'healthProIds': '" + healthPro +
                "'}"
                );
     }
     catch (Exception e)
     {
         return("{'status': 'failed'}");
     }
 }
コード例 #2
0
 public System.Threading.Tasks.Task <AuthenticationService.loginResponse1> loginAsync(AuthenticationService.loginRequest loginRequest)
 {
     AuthenticationService.loginRequest1 inValue = new AuthenticationService.loginRequest1();
     inValue.loginRequest = loginRequest;
     return(((AuthenticationService.AuthPort)(this)).loginAsync(inValue));
 }
コード例 #3
0
 public loginRequest1(AuthenticationService.loginRequest loginRequest)
 {
     this.loginRequest = loginRequest;
 }