public async Task <IActionResult> ExportReport() { var clients = await _clientServices.GetAllClients(); for (int c = 0; c < clients.Count; c++) { string emailHead = "Hola " + clients[c].Name + "," + br + "Este es un resumen de tu cuenta en Bitcoin Santa Fe al día " + DateTime.Today.ToShortDateString() + br; string emailTxt = emailHead; foreach (var f in clients[c].Futures) { emailTxt = emailHead + DateTime.Today.ToShortDateString() + br + "Cuenta: " + f.ContractNumber + br + "Capital inicial: " + String.Format("{0:.00}", f.Capital) + usdTxt + br; string signature = "Fecha de proximo retiro: " + f.FinishDate.ToShortDateString() + br; if (f.ContractNumber == (int)SpecialClients.Uno) { emailTxt = emailTxt + usdTConst + f.FinalResult + br + "Recuerde que el acumulado se ve afectado por los contratos de renta fija" + signature; } else { if (f.FixRent) { emailTxt = emailTxt + MensRent + f.FixRentPercentage + "%" + br + signature; } else { decimal percentage = (((f.FinalResult - f.Capital) / f.Capital) * 100); emailTxt = emailTxt + MensRent + String.Format("{0:.00}", percentage) + "%" + br + usdTConst + String.Format("{0:.00}", f.FinalResult) + usdTxt + br + signature; } } } emailTxt += finishMessage; var MailRequest = new MailRequestViewModel() { ToEmail = clients[c].Email, Subject = emailTitle, Body = emailTxt }; await _service.SendEmailAsync(MailRequest); } return(Ok()); }
public async Task <IActionResult> Index() { return(View(await _clientService.GetAllClients())); }