public async Task <object> GetCustomerVerificationandOTP(CustomerViewModel customerObj) { try { bool flag = true; int OTP; CustomerViewModel CustomerList = Mapper.Map <Customer, CustomerViewModel>(_customerBusiness.GetCustomerVerification(customerObj.Email)); if (CustomerList == null) { flag = false; } Random rnd = new Random(); // Random number creation for OTP OTP = rnd.Next(2000, 9000); //sending otp to mail. await _customerBusiness.SendCustomerOTP(OTP, customerObj.Email); return(JsonConvert.SerializeObject(new { Result = true, Records = new { Customer = CustomerList, IsUser = flag, CustomerOTP = OTP } })); } catch (Exception ex) { return(JsonConvert.SerializeObject(new { Result = false, Message = ex.Message })); } }