//JDR: Insert new creditScore in DB public static CreditScore UpdateCreditScore(int UserID) { //JDR: Call Api using (WebClient wc = new WebClient()) { var json = wc.DownloadString("https://dxc-banking-api.herokuapp.com/getCReditScore"); JObject jsonObj = JObject.Parse(json); //JDR: More Validation Login on response from API //...LOGIC... var Score = (int)jsonObj["creditScore"]; var CreditScore = new CreditScore().New(); CreditScore.UserID = UserID; CreditScore.Equifax = Score; CreditScore.TransUnion = Score; CreditScore.LastUpdatedDate = DateTime.Now; CreditScore.Save(); return(CreditScore); } }
public static int Register(dynamic Account) { //JDR: Setup User User User = new User().New(); User.FirstName = Account.FirstName.Trim(); User.MiddleName = (Account.MiddleName ?? "").Trim(); User.LastName = Account.LastName.Trim(); User.Email = Account.Email.Trim(); User.Telephone = Account.Telephone.Trim(); User.Password = GLOBAL.Hash(Account.Password, UserAccount.PasswordSalt); User.UserStatus = 0; User.CreatedDate = DateTime.Now; //JDR: Setup Address Address Address = new Address().New(); Address.Address1 = Account.Address; Address.City = Account.City; Address.State = Account.State; Address.ZipCode = Account.Zip; Address.Add(); //JDR: Add Address to DB User.AddressID = Address.ID; User.Add(); //JDR: Add User to DB //JDR: Get User CreditScore CreditScore.UpdateCreditScore(User.ID); //JDR: Create User confirmation code in DB var Confirmation = EmailConfirmation.SetEmailConfirmation(User.ID); /*#################################### REMOE /*####################################*/ //JDR: TODO: REMOVE: This is here just to fake user email confirmation link HttpContext.Current.Session["ConfirmEmail"] = User.Email; HttpContext.Current.Session["ConfirmCode"] = Confirmation.Token; /*#################################### REMOE /*####################################*/ return(User.ID); }
//JDR: Get user credit score public CreditScore GetCreditScore() { return(CreditScore.GetByUserID(this.ID)); }