public int CreateNewPractitioner(NewPractitionerViewModel newUser) { PractitionerBusiness businessLayer = new PractitionerBusiness(); NewPractitionerViewModel result = businessLayer.PractitionerRegister(newUser); if (result.ConflictEmailAddress == 1) { return(2); } if (result != null) { try { //Sent to Practitioner to inform waiting company actions string mailFrom = ConstantHelper.AppSettings.MailFrom; string emailSubject = ConstantHelper.Email.AccountVerification.EmailSubject; string emailBody = ConstantHelper.Email.AccountVerification.PractitionerEmailBody; string userName = ConstantHelper.AppSettings.UserName; string password = ConstantHelper.AppSettings.Password; EmailHelper.SentMail(mailFrom, result.EmailAddress, emailSubject, emailBody, userName, password); //Sent to Company to request actions string practitionerDetailsTable = "<table><tr><th>" + "Practitioner First Name" + "</th><td>" + result.FirstName + "</td></tr><tr><th>" + "Practitioner Last Name" + "</th><td>" + result.LastName + "</td></tr><tr><th>" + "Practitioner Gender" + "</th><td>" + result.Gender + "</td></tr><tr><th>" + "Practiitoner Email Address" + "</th><td>" + result.EmailAddress + "</td></tr><tr><th>" + "Role" + "</th><td>" + result.Role + "</td></tr><tr><th>" + "Specialist" + "</th><td>" + result.Specialist + "</td></tr></table>"; string linkToApprove = ConstantHelper.AppSettings.BackEndUrl + ConstantHelper.API.Practitioner.PractitionerApproved + "?accId=" + result.AccId; string linkToReject = ConstantHelper.AppSettings.BackEndUrl + ConstantHelper.API.Practitioner.PractitionerRejected + "?accId=" + result.AccId; string companyEmailSubject = ConstantHelper.Email.AccountVerification.PractitionerConfirmEmailSubject; string companyEmailBody = ConstantHelper.Email.AccountVerification.PractitionerConfirmEmailBody; companyEmailBody = companyEmailBody.Replace(ConstantHelper.Email.Keyword.PractitionerDetailsTable, practitionerDetailsTable); companyEmailBody = companyEmailBody.Replace(ConstantHelper.Email.Keyword.LinkToApprove, linkToApprove); companyEmailBody = companyEmailBody.Replace(ConstantHelper.Email.Keyword.LinkToReject, linkToReject); EmailHelper.SentMail(mailFrom, result.CompanyEmailAddress, companyEmailSubject, companyEmailBody, userName, password); } catch (Exception err) { new LogHelper().LogMessage("RegistrationController.CreateNewPatient : " + err); } return(1); } else { return(0); } }