/// <summary> /// Get All User /// </summary> /// <returns></returns> #region Get Method /// <summary> /// Get the user details by user id /// </summary> /// <param name="customerId"></param> /// <returns>user model</returns> public async Task <Users> GetUserByIdAsync(Guid customerId) { if (customerId == null || customerId == Guid.Empty) { return(null); } var user = await _userRepository.SelectAsync(u => u.UserId == customerId); if (user.Any()) { Users newUser = new Users(); newUser.UserId = user[0].UserId; newUser.UserName = user[0].UserName; newUser.Password = Convert.ToString(EncryptionandDecryption.Decrypt(user[0].Password)); newUser.MobileNo = user[0].MobileNo; newUser.Address = user[0].Address; newUser.Email = user[0].Email; newUser.Name = user[0].Name; newUser.SecurityAnswerOne = user[0].SecurityAnswerOne; newUser.SecurityAnswerTwo = user[0].SecurityAnswerTwo; newUser.PromoCode = user[0].PromoCode; newUser.PromoCodePoints = user[0].PromoCodePoints; return(newUser); } else { return(null); } }
public async Task <List <AdminAgentUserViewModel> > GetAdminAgentOperatorUsersAsync(List <string> userType) { var userList = await _userRepository.GetAdminAgentOperatorUsersAsync(userType); if (userList.Count() > 0) { for (int i = 0; i < userList.Count(); i++) { userList[i].Password = Convert.ToString(EncryptionandDecryption.Decrypt(userList[i].Password)); } } return(userList.ToList()); }
/// <summary> /// Check user exists /// </summary> /// <param name="login"></param> /// <returns></returns> public async Task <Users> GetUserDetailsAsync(Login login) { try { if (string.IsNullOrEmpty(login.UserName) || login.Password == null) { return(new Users()); } decimal result = 0; var user = new List <Users>(); var isMobileNumber = decimal.TryParse(login.UserName, out result); if (isMobileNumber) { user = (await _userRepository.SelectAsync(u => u.MobileNo == login.UserName)).ToList(); } else { user = (await _userRepository.SelectAsync(u => u.UserName == login.UserName)).ToList(); } var pasword = EncryptionandDecryption.Decrypt(user[0].Password); if (user.Count() > 0) { if (pasword == login.Password) { return(user[0]); } else { return(new Users()); } } else { return(new Users()); } } catch (Exception) { return(new Users()); } }