public Task <string> SendEmailSms(EmailSmsRequest dataRequest) { try { if (!string.IsNullOrEmpty(dataRequest.RecieptEmail)) { //send email string url = emailUrl + "?apikey=" + emailApiKey + "&subject=" + dataRequest.Subject + "&from=" + dataRequest.SenderEmail + "&fromName=Oga Madam&sender=" + dataRequest.SenderEmail + "&senderName=Oga Madam Team&replyTo=" + dataRequest.SenderEmail + "&to=" + dataRequest.RecieptEmail + "&bodyHtml=" + dataRequest.Message; var emailResponse = SmsEmailWebCall(url); } if (!string.IsNullOrEmpty(dataRequest.Phone)) { //send sms string url = smsUrl + "?username="******"&password="******"&sender=Oga Madam&recipient=" + dataRequest.Phone + "&message=" + dataRequest.Message + "&dnd=true"; var smsResponse = SmsEmailWebCall(url); } } catch (Exception) { throw; } return(null); }
public Task <bool> RegisterEmployee(RegisterModel model, string id) { return(Task.Run(() => { System.Threading.Thread.Sleep(1000); var employeeDetails = new Employee() { EmployeeId = id, BVN = model.ExtraData.BVN, NIMC = model.ExtraData.NIMC, CreatedAt = DateTime.Now }; switch (model.ExtraData.QualificationType) { case "Bsc": employeeDetails.QualificationType = QualificationType.Bsc; break; case "Hnd": employeeDetails.QualificationType = QualificationType.Hnd; break; case "Msc": employeeDetails.QualificationType = QualificationType.Msc; break; case "Ond": employeeDetails.QualificationType = QualificationType.Ond; break; default: employeeDetails.QualificationType = QualificationType.Ssce; break; } _db2.Employees.Add(employeeDetails); if (_db2.SaveChanges() == 1) { var content = new EmailSmsRequest() { From = "Oga Madam", Message = "Email confirmation", RecieptEmail = model.Email, SenderEmail = model.Email, Subject = "Email confirmation" }; SendEmailSms(content); //send phone verification return true; } return false; })); }
public Task <string> SendEmailSms(EmailSmsRequest dataRequest) { try { if (!string.IsNullOrEmpty(dataRequest.RecieptEmail)) { //send email } if (!string.IsNullOrEmpty(dataRequest.Phone)) { //send sms } } catch (Exception) { throw; } return(null); }
public bool RegisterEmployer(Employer employerDetails, RegisterBindingModel model) { _db2.Employers.Add(employerDetails); if (_db2.SaveChanges() == 1) { var content = new EmailSmsRequest() { From = "Oga Madam", Message = "Email confirmation", RecieptEmail = model.Email, SenderEmail = model.Email, Subject = "Email confirmation" }; SendEmailSms(content); //send phone verification return(true); } return(false); }