public void SaveUserLoginCredentials() { tblUserLoginCredentialsDto objUserLoginCredentialDto = new tblUserLoginCredentialsDto(); //Id objUserLoginCredentialDto.UserId = 101; objUserLoginCredentialDto.LoginPassword = Cryptography.Encrypt("Paresh@1234567"); objUserLoginCredentialDto.LastPasswordChanged = DateTime.Now; objUserLoginCredentialDto.LastFailedLogin = DateTime.Now; objUserLoginCredentialDto.FailedLoginCount = 2; objUserLoginCredentialDto.IsLocked = false; objUserLoginCredentialDto.UserType = 1; objUserLoginCredentialDto.Key = Cryptography.Encrypt("Paresh@1234567"); objUserLoginCredentialDto.Salt = Cryptography.Encrypt("Paresh@1234567"); objUserLoginCredentialDto.CreatedBy = "Paresh Rao"; objUserLoginCredentialDto.CreatedOn = DateTime.Now; objUserLoginCredentialDto.ModifiedBy = "Paresh Rao"; objUserLoginCredentialDto.ModifiedOn = DateTime.Now; objUserLoginCredentialDto.IPAddressOfLastAction = "192.168.168.1"; UserCredentialProvider objUserCredentialDataProvider = new UserCredentialProvider(); int returnVal = objUserCredentialDataProvider.SaveUserLoginCredentials(objUserLoginCredentialDto); Assert.AreEqual(1, returnVal, "It should return 1"); }
/// <summary> /// Saves login credentials /// </summary> /// <param name="userLoginCredentialBO"></param> /// <returns></returns> public int SaveUserLoginCredentials(UserLoginCredentialBO userLoginCredentialBO) { tblUserLoginCredentialsDto userLoginCredentialsDto = new tblUserLoginCredentialsDto(); Mapper.CreateMap<UserLoginCredentialBO, tblUserLoginCredentialsDto>(); Mapper.Map(userLoginCredentialBO, userLoginCredentialsDto); UserCredentialProvider objUserLoginCredentialsDataProvider = new UserCredentialProvider(); return objUserLoginCredentialsDataProvider.SaveUserLoginCredentials(userLoginCredentialsDto); }
/// <summary> /// Saves login credentials /// </summary> /// <param name="userLoginCredential"></param> /// <returns></returns> public int SaveUserLoginCredentials(tblUserLoginCredentialsDto userLoginCredential) { Mapper.CreateMap<tblUserLoginCredentialsDto, tblUserLoginCredential>(); int result = 0; try { using (var userLoginCredentialContext = new FPUserCredentialEntities()) { tblUserLoginCredential userLoginCredentials = new tblUserLoginCredential(); Mapper.Map(userLoginCredential, userLoginCredentials); userLoginCredentialContext.tblUserLoginCredentials.Add(userLoginCredentials); result = userLoginCredentialContext.SaveChanges(); } } catch { return -1; } return result; }