Ejemplo n.º 1
0
 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'}");
     }
 }