public async Task <ActionResult> ForgotPassword(ForgotPasswordViewModel model) { if (ModelState.IsValid) { var user = await UserManager.FindByEmailAsync(model.Email); if (user == null) // || !(await UserManager.IsEmailConfirmedAsync(user.Id)) { // Don't reveal that the user does not exist or is not confirmed TempData["mes"] = "Email không tìm thấy."; return(View("~/Views/Shared/Error.cshtml")); } // For more information on how to enable account confirmation and password reset please visit http://go.microsoft.com/fwlink/?LinkID=320771 // Send an email with this link string code = await UserManager.GeneratePasswordResetTokenAsync(user.Id); var callbackUrl = Url.Action("ResetPassword", "Account", new { userId = user.Id, code = code }, protocol: Request.Url.Scheme); await UserManager.SendEmailAsync(user.Id, "Reset mật khẩu", "Vui lòng click tại đây " + callbackUrl); //update mail today var config = _configServices.GetConfig(); config.MailSendToday += 1; _configServices.UpdateConfig(config); return(RedirectToAction("ForgotPasswordConfirmation", "Account")); } // If we got this far, something failed, redisplay form return(View(model)); }
public void Set() { try { var data = new PriceAll(); var client = new WebClient(); var content = client.DownloadString("https://api.coinmarketcap.com/v1/ticker/raiblocks"); var jsonXRB = JsonConvert.DeserializeObject <List <PriceXRB> >(content); if (jsonXRB != null) { data.PriceXRB = (float)Math.Round(float.Parse(jsonXRB[0].price_usd) * 20000, 0); } content = client.DownloadString("https://api.coinmarketcap.com/v1/ticker/bitcoin/"); var jsonBTC = JsonConvert.DeserializeObject <List <PriceBTC> >(content); if (jsonBTC != null) { data.PriceBTC = (float)Math.Round(float.Parse(jsonBTC[0].price_usd) * 22000, 0); } data.PriceUSD = 20000; //luu gia vao database var config = _configServices.GetConfig(); if (config.GiaXRB != data.PriceXRB || config.GiaBTC != data.PriceBTC) { config.GiaXRB = data.PriceXRB - 100; config.GiaBTC = data.PriceBTC; _configServices.UpdateConfig(config); } } catch (Exception) { } }
public async Task RunBotAsync() { await _client.SetGameAsync("::help to see the commands"); await _client.LoginAsync(TokenType.Bot, _config.GetConfig().Token); await _client.StartAsync(); _client.Log += LogAsync; await InitializeHandlers(); await Task.Delay(-1); }