public async void OnCreateUser(string key, ReceivingCreateUserModel model) { try { if (string.IsNullOrEmpty(model.email)) { this.Socket.Send(key, new SendingCreateUserModel() { emptyEmail = true }.Pack(false)); return; } bool blacklistMail = await this.Socket.Database.LoadBooleanAsync("SELECT COUNT(*) FROM [].tm_email_blacklist WHERE email={0};", model.email); if (blacklistMail) { this.Socket.Send(key, new SendingCreateUserModel() { refused = true }.Pack(false)); return; } this.Socket.Send(key, new SendingCreateUserModel() { }.Pack(true)); var lead = this.Socket.Lead; if (lead == null) { lead = await this.Socket.TryToIdentifyLead(string.Empty, model.email); } lead.TryUpdateEmail(this.Socket.Database, model.email); lead.UpdateLater(); this.Socket.Action.UpdateLead(lead); this.Socket.Action.Data.input_email = true; this.Socket.Action.Data.UpdateLater(); await this.Socket.Database.TransactionalManager.RunAsync(); } catch (Exception e) { this.Socket.Logging.StartLoggin("") .Where("lp-createUser") .Add(model) .OnException(e); this.Socket.Send(new FatalModel() { Action = "OnCreateUser", Exception = e.ToString() }.Pack(false, "error500")); } }
public async Task <DistributionModel> OnCreateUser(string key, ReceivingCreateUserModel model) { try { if (string.IsNullOrEmpty(model.email)) { return new SendingCreateUserModel() { emptyEmail = true } } .Pack(false); bool blacklistMail = await this.Database.LoadBooleanAsync("SELECT COUNT(*) FROM [].tm_email_blacklist WHERE email={0};", model.email); if (blacklistMail) { return new SendingCreateUserModel() { refused = true } }