public PatientViewModel PatientRegister(PatientViewModel vm) { PatientViewModel result = new PatientViewModel(); try { if (String.IsNullOrEmpty(vm.ContactNumber3)) { vm.ContactNumber3 = ""; } var salt = HashingHelper.GenerateSalt(); vm.Salt = salt; var hashedPassword = HashingHelper.ComputeHMAC_SHA256(Encoding.UTF8.GetBytes(vm.Password), vm.Salt); vm.Password = Convert.ToBase64String(hashedPassword); //Convert back aligned date time due to restsharp vm.DateOfBirth = vm.DateOfBirth.ToLocalTime(); //Process Home Address //vm.HomeAddressLine1 = vm.HomeAddressLine1.TrimEnd(','); //vm.HomeAddressLine2 = vm.HomeAddressLine2.TrimEnd(','); //vm.HomeAddressLine3 = vm.HomeAddressLine3.TrimEnd(','); PatientData dataLayer = new PatientData(); result = dataLayer.CreatePatient(vm); } catch (Exception err) { new LogHelper().LogMessage("PatientBusiness.PatientRegister : " + err); } return(result); }