public async Task UpdateLoginverification(CustomerRegistrationDto CustomerRegistrationDto) { var isvalid = Repository.SingleOrDefault(x => x.Username == CustomerRegistrationDto.Email); isvalid.Status = 1; await Repository.UpdateAsync(isvalid); }
public async Task <string> OTPMobileVerifyAuthenticate(CustomerRegistrationDto CustomerRegistrationDto) { //Internal testing Purpose //if (CustomerRegistrationDto.OTP==778899) //{ // return "Success"; //} var OTPVerifyResponse = Repository.SingleOrDefault(x => x.VerificationId == CustomerRegistrationDto.Mobile && x.OTP == CustomerRegistrationDto.MobileOTP); if (OTPVerifyResponse == null) { return("Invalid MobileOTP!"); } if (OTPVerifyResponse != null) { DateTime Presentdate = DateTime.Now; var query = this.Repository.ToList(); query = query.Where(m => Presentdate >= m.StartDate && Presentdate <= m.EndDate) .Where(m => m.VerificationId == CustomerRegistrationDto.Mobile) .Where(m => m.OTP == CustomerRegistrationDto.MobileOTP).ToList(); if (query.Count > 0) { return("Success"); } } return("MobileOTP Expried!"); }
public async Task UpdateRegistrationDetails(CustomerRegistrationDto CustomerRegistrationDto) { var isvalid = Repository.SingleOrDefault(x => x.Email == CustomerRegistrationDto.Email); //if (!string.IsNullOrEmpty(CustomerRegistrationDto.Image)) //{ isvalid.Image = CustomerRegistrationDto.Image; //} if (!string.IsNullOrEmpty(CustomerRegistrationDto.FirstName)) { isvalid.FirstName = CustomerRegistrationDto.FirstName; } if (!string.IsNullOrEmpty(CustomerRegistrationDto.LastName)) { isvalid.LastName = CustomerRegistrationDto.LastName; } if (!string.IsNullOrEmpty(CustomerRegistrationDto.Address)) { isvalid.Address = CustomerRegistrationDto.Address; } if (!string.IsNullOrEmpty(CustomerRegistrationDto.Country)) { isvalid.Country = Convert.ToInt32(CustomerRegistrationDto.Country); } if (!string.IsNullOrEmpty(CustomerRegistrationDto.City)) { isvalid.City = CustomerRegistrationDto.City; } if (!string.IsNullOrEmpty(CustomerRegistrationDto.Mobile)) { isvalid.Mobile = CustomerRegistrationDto.Mobile; } await Repository.UpdateAsync(isvalid); }
public async Task <IActionResult> OTPAuthentication([FromBody] CustomerRegistrationDto CustomerRegistrationDto) { int _returnOTP = 0; try { _returnOTP = await _OTPAuthenticationService.InsertOTPAuthentication(CustomerRegistrationDto); try { string strURL = _configuration["EmailSender:URL"]; string Message = "<table width='100%'><tr><td> Dear Customer,</td></tr><tr><td style='padding: 10px 0 10px 0; '>The One Time Password (OTP) for your Dunyana account is: <b>" + _returnOTP + "</b>.</td></tr><tr><td style='padding: 10px 0 10px 0;'>This OTP is valid for one minute or 1 successful attempt whichever is earlier. Please note, this OTP is valid only for this Dunyana customer registration and cannot be used for any Dunyana customer registration.</td></tr><tr><td style='padding: 10px 0 10px 0;'> Please do not share this One Time Password with anyone.</td></tr><tr><td style='padding: 15px 0 15px 0;'> Regards,<br /> Dunyana</td></tr></table>"; await _emailService.SendEmail(CustomerRegistrationDto.Email, "One Time Password (OTP) for your Dunyana verification", Message); } catch (Exception ex) { return(BadRequest(new GenericResultDto <string> { Result = ex.Message })); } } catch (Exception err) { return(BadRequest(new GenericResultDto <string> { Result = err.Message })); } return(Ok(new GenericResultDto <string> { Result = "Check your registered Email address for One-Time-Password(OTP) and enter the code here", ReFirstName = CustomerRegistrationDto.FirstName, ReEmail = CustomerRegistrationDto.Email, OTP = _returnOTP.ToString() })); }
public async Task UpdateEmailverification(CustomerRegistrationDto CustomerRegistrationDto) { var isvalid = Repository.SingleOrDefault(x => x.Email == CustomerRegistrationDto.Email); isvalid.EmailVerified = 1; await Repository.UpdateAsync(isvalid); }
public async Task <IActionResult> EmailCheckValidation([FromBody] CustomerRegistrationDto CustomerRegistrationDto) { try { var _checkLoginAuthentication = await _UsersService.LoginAuthenticate(CustomerRegistrationDto); if (_checkLoginAuthentication == null) { return(Ok(new GenericResultDto <string> { Result = "Email is valid" })); } else { return(Ok(new GenericResultDto <string> { Result = "Email Id already registered", ReEmail = _checkLoginAuthentication.Username, LoginType = _checkLoginAuthentication.Type })); } } catch (Exception err) { return(BadRequest(new GenericResultDto <string> { Result = err.Message })); } return(Ok(new GenericResultDto <string> { Result = "Valid email " })); }
public async Task <IActionResult> RegisterCustomer(CustomerRegistrationDto registrationDto) { Result <CustomerFirstName> customerFirstNameOrError = CustomerFirstName.Create(registrationDto.FirstName); Result <CustomerLastName> customerLastNameOrError = CustomerLastName.Create(registrationDto.LastName); Result <CustomerDateOfBirth> customerDOBOrError = CustomerDateOfBirth.Create(registrationDto.DateOfBirth); Result <Email> emailOrError = Email.Create(registrationDto.Email); Result <PolicyReferenceNumber> policyReferenceOrError = PolicyReferenceNumber.Create(registrationDto.PolicyReferenceNumber); var result = Result.Combine(customerFirstNameOrError, customerLastNameOrError, customerDOBOrError, emailOrError, policyReferenceOrError); if (result.IsFailure) { return(BadRequest(result.Error)); } var customerEntity = _mapper.Map <Customer>(registrationDto); await _customerRepository.AddItemAsync(customerEntity); await _customerRepository.SaveAsync(); var customerToReturn = _mapper.Map <CustomerDto>(customerEntity); _logger.LogInformation($"a customer id {customerToReturn.Id} is registered"); return(CreatedAtRoute("GetCustomer", new { id = customerToReturn.Id }, customerToReturn)); }
public async Task <IActionResult> MobileCheckValidation([FromBody] CustomerRegistrationDto CustomerRegistrationDto) { try { var _checkMobileLoginAuthentication = await _UsersService.MobileAuthenticate(CustomerRegistrationDto); if (_checkMobileLoginAuthentication == 0) { return(Ok(new GenericResultDto <string> { Result = "Mobile is available" })); } else { return(Ok(new GenericResultDto <string> { Result = "Mobile is already registered" })); } } catch (Exception err) { return(BadRequest(new GenericResultDto <string> { Result = err.Message })); } }
public async Task <Users> LoginAuthenticate(CustomerRegistrationDto CustomerRegistrationDto) { var isvalid = Repository.SingleOrDefault(x => x.Username == CustomerRegistrationDto.Email); if (isvalid == null) { return(null); } return(isvalid); }
public async Task <int> getCustomerID(string strGUID) { CustomerRegistrationDto objCustomerRegistrationDto = new CustomerRegistrationDto(); var getCustomerEmail = Repository.SingleOrDefault(x => x.GUID == strGUID); objCustomerRegistrationDto.Email = getCustomerEmail.Username; var getCustomerID = await _CustomerRegistrationService.Authenticate(objCustomerRegistrationDto); return(getCustomerID.Id); }
public async Task UpdateGUID(CustomerRegistrationDto CustomerRegistrationDto) { Guid id = Guid.NewGuid(); var isvalid = Repository.SingleOrDefault(x => x.Username == CustomerRegistrationDto.Email); if (string.IsNullOrEmpty(isvalid.GUID)) { isvalid.GUID = id.ToString(); await Repository.UpdateAsync(isvalid); } }
public async Task <IActionResult> RegisterCustomer([FromBody] CustomerRegistrationDto model) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } var userIdentity = _mapper.Map <AppUser>(model); var result = await _userManager.CreateAsync(userIdentity, model.Password); if (!result.Succeeded) { if (result.Errors.FirstOrDefault(o => o.Code == "DuplicateUserName") != null) { ModelState.AddModelError(nameof(CustomerRegistrationDto), "User name already taken"); } return(BadRequest(ModelState)); } var customer = _mapper.Map <Customer>(model); customer.IdentityId = userIdentity.Id; var addres = await _usersRepository.AddCustomer(customer); if (!addres) { return(Conflict()); } var customerDto = _mapper.Map <CustomerDto>(model); customerDto.Id = customer.Id; if (!userIdentity.EmailConfirmed) { var confirmToken = await _userManager.GenerateEmailConfirmationTokenAsync(userIdentity); var emailConfirmUrl = Url.RouteUrl("ConfirmEmail", new { uid = userIdentity.Id, token = confirmToken }, this.Request.Scheme); try { await _emailSender.SendEmailAsync(userIdentity.Email, "Confirm your account", $"Please confirm your account by this ref <a href=\"{emailConfirmUrl}\">link</a>"); } catch { ModelState.AddModelError("email", "Failed to send confirmation letter"); return(BadRequest(ModelState)); } } return(CreatedAtRoute("GetCustomer", new { id = customer.Id }, customerDto)); }
public async Task UserDetails(CustomerRegistrationDto CustomerRegistrationDto) { Guid id = Guid.NewGuid(); await Repository.InsertAsync(new Users { Username = CustomerRegistrationDto.Email, PWD = EncryptionHelper.Encrypt(CustomerRegistrationDto.PWD), Type = CustomerRegistrationDto.Type, GUID = id.ToString(), Status = 1, }); }
public async Task ChangePassword(CustomerRegistrationDto CustomerRegistrationDto) { //var isvalid = Repository.SingleOrDefault(x => x.Username == CustomerRegistrationDto.Email); //isvalid.PWD = EncryptionHelper.Encrypt(CustomerRegistrationDto.PWD); //await Repository.UpdateAsync(isvalid); var isvalid = Repository.SingleOrDefault(x => x.Username == CustomerRegistrationDto.Email); var ECID = EncryptionHelper.Encrypt(CustomerRegistrationDto.PWD); await _MerchantRequestAduitServices.AuditPassword(isvalid.PWD, ECID, isvalid.Id); isvalid.PWD = ECID; await Repository.UpdateAsync(isvalid); }
public async Task <int?> PostCustomerRegistration(CustomerRegistrationDto customerRegistrationDto) { try { var customerRegistration = new CustomerRegistration { Forename = customerRegistrationDto.Forename, Surname = customerRegistrationDto.Surname, PolicyReferenceNumber = customerRegistrationDto.PolicyReferenceNumber, Email = customerRegistrationDto.Email, DateOfBirth = customerRegistrationDto.DateOfBirth }; _context.CustomerRegistrations.Add(customerRegistration); await _context.SaveChangesAsync(); var attempts = 10; while (attempts-- > 0) { var customer = new Customer { Forename = customerRegistration.Forename, Surname = customerRegistration.Surname, Email = customerRegistration.Email, DateOfBirth = customerRegistration.DateOfBirth, CustomerRegistration = customerRegistration, Policies = new List <Policy> { new Policy { ReferenceNumber = customerRegistration.PolicyReferenceNumber } } }; _context.Customers.Add(customer); if (await _context.SaveChangesAsync() > 0) { return(customer.OnlineReference); } } HttpContext.Response.StatusCode = (int)HttpStatusCode.InternalServerError; return(null); } catch (Exception e) { _logger.LogError(e, "Error occurred whilst registering the customer"); throw; } }
public async Task <Users> UserPWD(CustomerRegistrationDto CustomerRegistrationDto) { var isvalid = Repository.SingleOrDefault(x => x.Username == CustomerRegistrationDto.Email); //if (EncryptionHelper.Decrypt(isvalid.PWD) == CustomerRegistrationDto.PWD) //{ if (isvalid != null) { isvalid.PWD = EncryptionHelper.Decrypt(isvalid.PWD); } return(isvalid); //} //return null; }
public async Task <IActionResult> UpdateRegistrationDetails([FromBody] CustomerRegistrationDto CustomerRegistrationDto) { try { Guid ProfileImage = Guid.NewGuid(); if (!String.IsNullOrEmpty(CustomerRegistrationDto.Image)) { if (CustomerRegistrationDto.Image.Substring(CustomerRegistrationDto.Image.Length - 3) != "jpg") { strImagePath = _configuration["FilePath:ImagePath"] + "ProfileImages/"; if (!String.IsNullOrEmpty(CustomerRegistrationDto.Image)) { if (!Directory.Exists(strImagePath)) { Directory.CreateDirectory(strImagePath); } Byte[] imageByteData = Convert.FromBase64String(CustomerRegistrationDto.Image); var fs = new BinaryWriter(new FileStream(strImagePath + ProfileImage + ".jpg", FileMode.Create, FileAccess.Write)); fs.Write(imageByteData); fs.Close(); CustomerRegistrationDto.Image = ProfileImage + ".jpg"; } } else { CustomerRegistrationDto.Image = Path.GetFileName(CustomerRegistrationDto.Image); } } else { CustomerRegistrationDto.Image = ""; } await _CustomerRegistrationService.UpdateRegistrationDetails(CustomerRegistrationDto); } catch (Exception err) { return(BadRequest(new GenericResultDto <string> { Result = err.Message })); } return(Ok(new GenericResultDto <string> { Result = "Customer updated successfully", ReFirstName = CustomerRegistrationDto.FirstName, ReEmail = CustomerRegistrationDto.Email })); }
public async Task <int> InsertOTPAuthentication(CustomerRegistrationDto CustomerRegistrationDto) { //var varCount = this.Repository.ToList(); //varCount = varCount.Where(m => m.VerificationId == CustomerRegistrationDto.Email).ToList(); //if (varCount.Count < 4) //{ Random random = new Random(); int intOTP = random.Next(100000, 999999); DateTime currentTime = DateTime.Now; await Repository.InsertAsync(new OTPAuthentication { OTP = intOTP, VerificationId = CustomerRegistrationDto.Email, StartDate = currentTime, EndDate = currentTime.AddMinutes(5), }); return(intOTP); //} //return "_" + varCount.Count.ToString(); }
public async Task <IActionResult> Register([FromBody] CustomerRegistrationDto data) { if (ModelState.IsValid) { var user = new Customer { UserName = data.Email, Email = data.Email, FullName = data.FullName, DateOfBirthsday = data.DateOfBirthsday }; var result = await _userManager.CreateAsync(user, data.Password); if (result.Succeeded) { return(Ok("User has been successfully created")); } } return(BadRequest("Server error")); }
public async Task <IActionResult> Register([FromBody] CustomerRegistrationDto data) { if (ModelState.IsValid) { var user = new Customer { UserName = data.Email, Email = data.Email, FullName = data.FullName, DateOfBirthsday = data.DateOfBirthsday }; var result = await _userManager.CreateAsync(user, data.Password); if (result.Succeeded) { return(Json(JsonResultData.Success())); } } return(Json(JsonResultData.Error("User already exists."))); }
public async Task <IActionResult> InsertCustomerDetails([FromBody] InsertCustomerRegistrationDto InsertCustomerRegistrationDto) { try { CustomerRegistrationDto CustomerRegistrationDto = new CustomerRegistrationDto(); CustomerRegistrationDto.Email = InsertCustomerRegistrationDto.Email; CustomerRegistrationDto.Country = InsertCustomerRegistrationDto.Country; CustomerRegistrationDto.LoginType = InsertCustomerRegistrationDto.LoginType; CustomerRegistrationDto.PWD = InsertCustomerRegistrationDto.PWD; CustomerRegistrationDto.OTP = InsertCustomerRegistrationDto.OTP; CustomerRegistrationDto.MobileOTP = InsertCustomerRegistrationDto.MobileOTP; CustomerRegistrationDto.Mobile = InsertCustomerRegistrationDto.Mobile; if (InsertCustomerRegistrationDto.TermandCondition == "Y") { InsertCustomerRegistrationDto.TermandCondition = Convert.ToString(1); } else if (InsertCustomerRegistrationDto.TermandCondition == "N") { InsertCustomerRegistrationDto.TermandCondition = Convert.ToString(0); } var _emailCheck = await _UsersService.LoginAuthenticate(CustomerRegistrationDto); if (_emailCheck == null) { var _OTPVerifyResponse = await _OTPAuthenticationService.OTPVerifyAuthenticate(CustomerRegistrationDto); var _CountryCode = await _LookupTypeValuesService.GetCountryName(CustomerRegistrationDto.Country); if (_OTPVerifyResponse == "Success") { if (_CountryCode == "SAR") { var _OTPMobileVerifyResponse = await _OTPAuthenticationService.OTPMobileVerifyAuthenticate(CustomerRegistrationDto); if (_OTPMobileVerifyResponse == "Success") { CustomerRegistrationDto.Type = "C"; await _UsersService.UserDetails(CustomerRegistrationDto); int getuserID = await _UsersService.getUsersId(CustomerRegistrationDto.Email); CustomerRegistrationDto.UsersID = getuserID; await _CustomerRegistrationService.InsertRegistrationDetails(InsertCustomerRegistrationDto, getuserID); await _OTPAuthenticationService.DeleteOTPVerifydetails(CustomerRegistrationDto); await _OTPAuthenticationService.DeleteMobileOTPVerifydetails(CustomerRegistrationDto); } else { return(BadRequest(new GenericResultDto <string> { Result = _OTPMobileVerifyResponse, ReEmail = CustomerRegistrationDto.Mobile })); } } else { CustomerRegistrationDto.Type = "C"; await _UsersService.UserDetails(CustomerRegistrationDto); int getuserID = await _UsersService.getUsersId(CustomerRegistrationDto.Email); CustomerRegistrationDto.UsersID = getuserID; await _CustomerRegistrationService.InsertRegistrationDetails(InsertCustomerRegistrationDto, getuserID); await _OTPAuthenticationService.DeleteOTPVerifydetails(CustomerRegistrationDto); } } else { return(BadRequest(new GenericResultDto <string> { Result = _OTPVerifyResponse, ReEmail = CustomerRegistrationDto.Email })); } } else { return(BadRequest(new GenericResultDto <string> { Result = "Email Id already registered", LoginType = _emailCheck.Type, ReEmail = _emailCheck.Username })); } } catch (Exception err) { return(BadRequest(new GenericResultDto <string> { Result = err.Message })); } return(Ok(new GenericResultDto <string> { Result = "Customer registration successfull", LoginType = "C", ReFirstName = InsertCustomerRegistrationDto.FirstName, ReEmail = InsertCustomerRegistrationDto.Email })); }
public async Task <IActionResult> UpdateChangePassword([FromBody] CustomerRegistrationDto CustomerRegistrationDto) { try { var _types = await _UsersService.LoginAuthenticate(CustomerRegistrationDto); if (_types != null) { if (!String.IsNullOrEmpty(CustomerRegistrationDto.OldPWD)) { if (EncryptionHelper.Decrypt(_types.PWD) == CustomerRegistrationDto.OldPWD) { var list = (from t in _types.UserAduit orderby t.CreatedDate descending select t).Take(3); foreach (var Auditloop in list) { if (EncryptionHelper.Decrypt(Auditloop.Newvalue) == CustomerRegistrationDto.PWD) { return(BadRequest(new GenericResultDto <string> { Result = "Choose a password that is different from your last 3 passwords" })); } } if (EncryptionHelper.Decrypt(_types.PWD) != CustomerRegistrationDto.PWD) { await _UsersService.ChangePassword(CustomerRegistrationDto); await _OTPAuthenticationService.DeleteOTPVerifydetails(CustomerRegistrationDto); return(Ok(new GenericResultDto <string> { Result = "Your password has been changed" })); } else { return(BadRequest(new GenericResultDto <string> { Result = "Choose a password that is different from your last 3 passwords" })); } } else { return(BadRequest(new GenericResultDto <string> { Result = "The old password you have entered is incorrect" })); } } else { var list = (from t in _types.UserAduit orderby t.CreatedDate descending select t).Take(3); foreach (var Auditloop in list) { if (EncryptionHelper.Decrypt(Auditloop.Newvalue) == CustomerRegistrationDto.PWD) { return(BadRequest(new GenericResultDto <string> { Result = "Choose a password that is different from your last 3 passwords" })); } } if (EncryptionHelper.Decrypt(_types.PWD) != CustomerRegistrationDto.PWD) { await _UsersService.ChangePassword(CustomerRegistrationDto); await _OTPAuthenticationService.DeleteOTPVerifydetails(CustomerRegistrationDto); return(Ok(new GenericResultDto <string> { Result = "Your password has been changed" })); } else { return(BadRequest(new GenericResultDto <string> { Result = "Choose a password that is different from your last 3 passwords" })); } } } else { return(BadRequest(new GenericResultDto <string> { Result = "Invalid email" })); } } catch (Exception err) { return(BadRequest(new GenericResultDto <string> { Result = err.Message })); } return(Ok(new GenericResultDto <string> { Result = "Your password has been changed" })); }
public async Task <IActionResult> InsertMerchantDetails([FromBody] InsertMerchantDto InsertMerchantDto) { try { Guid MerchantRequestId = Guid.NewGuid(); CustomerRegistrationDto CustomerRegistrationDto = new CustomerRegistrationDto(); CustomerRegistrationDto.Email = InsertMerchantDto.Email; var _emailCheck = await _UsersService.LoginAuthenticate(CustomerRegistrationDto); if (InsertMerchantDto.TermandCondition == "Y") { InsertMerchantDto.TermandCondition = Convert.ToString(1); } else if (InsertMerchantDto.TermandCondition == "N") { InsertMerchantDto.TermandCondition = Convert.ToString(0); } if (_emailCheck == null) { strMerchantImages = _configuration["FilePath:ImagePath"] + "MerchantImages/"; if (!String.IsNullOrEmpty(InsertMerchantDto.ProfileImage)) { if (!Directory.Exists(strMerchantImages)) { Directory.CreateDirectory(strMerchantImages); } Byte[] imageByteData = Convert.FromBase64String(InsertMerchantDto.ProfileImage); var fs = new BinaryWriter(new FileStream(strMerchantImages + ProfileImage + ".jpg", FileMode.Append, FileAccess.Write)); fs.Write(imageByteData); fs.Close(); InsertMerchantDto.ProfileImage = ProfileImage + ".jpg"; } else { InsertMerchantDto.ProfileImage = ""; } if (!String.IsNullOrEmpty(InsertMerchantDto.CompanyImage)) { if (!Directory.Exists(strMerchantImages)) { Directory.CreateDirectory(strMerchantImages); } Byte[] imageByteData = Convert.FromBase64String(InsertMerchantDto.CompanyImage); var fs = new BinaryWriter(new FileStream(strMerchantImages + CompanyImage + ".jpg", FileMode.Append, FileAccess.Write)); fs.Write(imageByteData); fs.Close(); InsertMerchantDto.CompanyImage = CompanyImage + ".jpg"; } else { InsertMerchantDto.CompanyImage = ""; } CustomerRegistrationDto objCustomerRegistrationDto = new CustomerRegistrationDto(); objCustomerRegistrationDto.Email = InsertMerchantDto.Email; objCustomerRegistrationDto.PWD = InsertMerchantDto.PWD; objCustomerRegistrationDto.Type = "M"; MerchantDto MerchantDto = new MerchantDto(); MerchantDto.Email = InsertMerchantDto.Email; await _UsersService.UserDetails(objCustomerRegistrationDto); int getuserID = await _UsersService.getUsersId(InsertMerchantDto.Email); await _MerchantService.InsertMerchantDetails(InsertMerchantDto, getuserID); var getMerchantID = await _MerchantService.GetMerchantDetails(MerchantDto); await _MerchantCategoryService.InsertMerchantCategory(getMerchantID.Id, InsertMerchantDto.Categories); await _MerchantSellCountriesService.InsertSellCountriesDetails(getMerchantID.Id, InsertMerchantDto.SellCountries); await _MerchantRequestService.InsertRequestDetails(getMerchantID.Id, 24, "Open Request", 4, MerchantRequestId.ToString()); var getMerchantRequestId = await _MerchantRequestService.GetMerchantRequestId(MerchantRequestId.ToString()); if (getMerchantRequestId > 0) { await _MerchantRequestDetailsService.InsertMerchantRequestDetails(getMerchantRequestId, 24, "Open Request", 4); } string strEmaiL = _configuration["EmailSender:Email"]; string Message = "<table width='100%'><tr><td> Dear Admin,</td></tr><tr><td style='padding: 10px 0 10px 0; '>New Merchant Registration.</td></tr><tr><td style='padding: 10px 0 10px 0;'> <b>" + InsertMerchantDto.Name + " </b> has registered on the dunyana</td></tr><tr><td style='padding: 15px 0 15px 0;'> Regards,<br /> Dunyana</td></tr></table>"; await _emailService.SendEmail(strEmaiL, "New Merchant Registration", Message); } else { return(BadRequest(new GenericResultDto <string> { Result = "Email Id already registered", LoginType = _emailCheck.Type, ReEmail = _emailCheck.Username })); } } catch (Exception err) { return(BadRequest(new GenericResultDto <string> { Result = err.Message })); } return(Ok(new GenericResultDto <string> { Result = "We have received your registration request, Please allow us some time to process.", ReFirstName = InsertMerchantDto.Name, ReEmail = InsertMerchantDto.Email })); }
public async Task DeleteMobileOTPVerifydetails(CustomerRegistrationDto CustomerRegistrationDto) { var varCount = this.Repository.Where(m => m.VerificationId == CustomerRegistrationDto.Mobile).ToList(); await Repository.DeleteAsync(varCount); }
public async Task <int> MobileAuthenticate(CustomerRegistrationDto CustomerRegistrationDto) { var isvalid = Repository.Where(x => x.CustomerRegistration.Mobile == CustomerRegistrationDto.Mobile).ToList(); return(isvalid.Count()); }
public async Task <IActionResult> InsertUser([FromBody] JObject jsonResult) { try { Guid Pwdid = Guid.NewGuid(); UserDto userDto = JsonConvert.DeserializeObject <UserDto>(jsonResult.ToString()); CustomerRegistrationDto CustomerRegistrationDto = new CustomerRegistrationDto(); CustomerRegistrationDto.Email = userDto.Email; CustomerRegistrationDto.FirstName = userDto.FirstName; CustomerRegistrationDto.LastName = userDto.LastName; CustomerRegistrationDto.Mobile = userDto.Mobile; CustomerRegistrationDto.Country = userDto.Country; CustomerRegistrationDto.PWD = Pwdid.ToString().Substring(0, 7); CustomerRegistrationDto.Address = userDto.Address; string _getNaqelUsertypedec = await _lookupTypeValuesService.Getlookupdec(Convert.ToInt32(userDto.NaqelUserType)); CustomerRegistrationDto.Type = _getNaqelUsertypedec; var _checkLoginAuthentication = await _usersService.LoginAuthenticate(CustomerRegistrationDto); if (_checkLoginAuthentication == null) { await _usersService.UserDetails(CustomerRegistrationDto); int getuserID = await _usersService.getUsersId(userDto.Email); if (getuserID > 0) { await _naqelUsersService.AddNaqelUser(new NaqelUsers { FirstName = userDto.FirstName, LastName = userDto.LastName, Mobile = userDto.Mobile, Email = userDto.Email, Address = userDto.Address, Country = Convert.ToInt32(userDto.Country), Image = "", UsersID = getuserID, UserType = userDto.NaqelUserType }); try { string strURL = _configuration["EmailSender:URL"]; string Message = "<table width='100%'><tr><td> Dear " + userDto.FirstName + " " + userDto.LastName + ",</td></tr><tr><td style='padding: 10px 0 10px 0; '>Your Dunyana Account has been created, Welcome to the Dunyana.</td></tr><tr><td style='padding: 10px 0 10px 0;'>From now on, please log in to your account using email: " + userDto.Email + " and password: "******"</td></tr><tr><td style='padding: 10px 0 10px 0;'> Please do not share this Password with anyone.</td></tr><tr><td style='padding: 15px 0 15px 0;'> Regards,<br /> Dunyana</td></tr></table>"; await _emailService.SendEmail(CustomerRegistrationDto.Email, "Your Registration Details for Dunyana Account", Message); } catch (Exception ex) { return(Ok(new GenericResultDto <string> { Result = "Unable to send email to the user.", ReEmail = _checkLoginAuthentication.Username, LoginType = _checkLoginAuthentication.Type, LoginStatus = "F" })); } return(Ok(new GenericResultDto <string> { Result = "User login details has been sent to email id", LoginStatus = "S" })); } } else { return(Ok(new GenericResultDto <string> { Result = "Email Id already registered", ReEmail = _checkLoginAuthentication.Username, LoginType = _checkLoginAuthentication.Type, LoginStatus = "F" })); } return(BadRequest(new GenericResultDto <string> { Result = "User not created", LoginStatus = "F" })); } catch (Exception err) { return(BadRequest(new GenericResultDto <string> { Result = err.Message, LoginStatus = "F" })); } return(Ok(new GenericResultDto <string> { Result = "Categories created successfully" })); }