public static UserBalance FindOrCreate(UserModel user, CurrencyType currencyType) { return(Find(user) ?? Create( UserRepository.Find(user.id), currencyType )); }
public static UserModel Create(string email, string login, string password) { var newUserId = UserModel.Create(email, login, password); DiscordWebhooks.SendEvent("system-events", $"New user #{newUserId} just signed up! Email: {email}"); return(Find(newUserId)); }
public static UserBalance Create( UserModel user = null, decimal amount = 0, CurrencyType currencyType = CurrencyType.BitCoin ) { user = user ?? UserFaker.Create(); var id = UserBalance.Create(user, currencyType, amount); return(UserBalanceRepository.Find(id)); }
public static UsersVotepower FindOrCreate(UserModel user, Model.Project.Project project) { var votepower = UsersVotepower.Find(user, project); if (votepower == null) { votepower = Create(user, project); } return(votepower); }
public static UserModel Find(int id) { var cached = ModelCache.Get("User", id); if (cached != null) { return((UserModel)cached); } var item = UserModel.Find(id); if (item != null) { ModelCache.Store("User", item.id, item); } return(item); }
public static UserModel FindByGuid(string guid) { var cached = ModelCache.Get("User", guid); if (cached != null) { return((UserModel)cached); } var item = UserModel.FindByGuid(guid); if (item != null) { ModelCache.Store("User", item.guid, item); } return(item); }
public static UserModel FindOrCreateByEmailAndLogin( string email, string login, string password = null, UserModel referral = null ) { password ??= Rand.RandomString(); var user = UserModel.FindByEmail(email); var loginUser = UserModel.FindByLogin(login); var baseLogin = login; int postfixNum = 0; while (loginUser != null) { postfixNum++; login = $"{baseLogin}_{postfixNum}"; loginUser = UserModel.FindByLogin(login); } user ??= Create(email, login, password); UserBadge.Create(user, "Early adopter"); int tokenRegisterBonus = System.Convert.ToInt32( AppConfig.GetConfiguration("user:registration:token_bonus") ); if (tokenRegisterBonus > 0) { UserBalance.Create(user, CurrencyType.GitComToken, tokenRegisterBonus); FundingTransaction.Create( user, user.id, EntityType.User, null, tokenRegisterBonus, CurrencyType.GitComToken ); } if (referral != null) { UserReferralRepository.Create(user, referral); } return(user); }
public static UserBalance[] GetPositive(UserModel user, ushort limit = 10) { return(UserBalance.GetPositive(user, limit)); }
public static UserBalance Create(UserModel user, CurrencyType currencyType, decimal setBalance = 0) { return(Find(UserBalance.Create(user, currencyType, setBalance))); }
public static UserBalance Find(UserModel user, CurrencyType currencyType) => UserBalance.Find(user, currencyType);
public static UserBalance Find(UserModel user) { return(UserBalance.FindByUserId(user.id)); }
public static UsersVotepower Create(UserModel user, Model.Project.Project project) { return(Find(UsersVotepower.Create(user, project))); }
public static UsersVotepower Find(UserModel user, Model.Project.Project project) { return(UsersVotepower.Find(user, project)); }
public static UserModel FindByLogin(string login) { return(UserModel.FindByLogin(login)); }
public static UserModel FindByEmail(string email) { return(UserModel.FindByEmail(email)); }