Ejemplo n.º 1
0
 public AgentController(IConfiguration configuration, LoanManagementContext dbContext, IMapper mapper, IHostingEnvironment hostingEnvironment)
 {
     _configuration      = configuration;
     _dbContext          = dbContext;
     _mapper             = mapper;
     _hostingEnvironment = hostingEnvironment;
 }
Ejemplo n.º 2
0
 public CustomerController(LoanManagementContext loanManagementContext, IMapper mapper, IHostingEnvironment hostingEnvironment, IConfiguration configuration)
 {
     _context            = loanManagementContext;
     _mapper             = mapper;
     _hostingEnvironment = hostingEnvironment;
     _configuration      = configuration;
 }
Ejemplo n.º 3
0
        public static bool SendEmail(long emailTemplateId, Dictionary <string, string> replacements, string toEmail)
        {
            LoanManagementContext _dbContext = new LoanManagementContext();

            try
            {
                EmailTemplate template = _dbContext.EmailTemplate.FirstOrDefault(x => x.EmailTemplateId == emailTemplateId);

                if (template != null)
                {
                    string body = template.Text;
                    replacements.ToList().ForEach(x =>
                    {
                        body = body.Replace(x.Key, Convert.ToString(x.Value));
                    });
                    // Plug in your email service here to send an email.
                    var msg = new MimeMessage();
                    msg.From.Add(new MailboxAddress("LoanAgent Admin", "*****@*****.**"));
                    msg.To.Add(new MailboxAddress(toEmail));
                    //msg.Bcc.Add(new MailboxAddress(template.EmailBcc));
                    msg.Subject = template.Title;
                    var bodyBuilder = new BodyBuilder();
                    bodyBuilder.HtmlBody = body;
                    msg.Body             = bodyBuilder.ToMessageBody();


                    using (var smtp = new SmtpClient())
                    {
                        smtp.Connect("smtp.gmail.com", 465, SecureSocketOptions.SslOnConnect);
                        smtp.Authenticate(credentials: new NetworkCredential("*****@*****.**", "ankit2635"));
                        smtp.Send(msg, CancellationToken.None);
                        smtp.Disconnect(true, CancellationToken.None);
                    }

                    return(true);
                }
                return(false);
            }
            catch (Exception ex)
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
 public DashboardController(IConfiguration configuration, LoanManagementContext dbContext, IMapper mapper)
 {
     _configuration = configuration;
     _dbContext     = dbContext;
     _mapper        = mapper;
 }
Ejemplo n.º 5
0
 public AccountController(IConfiguration configuration, LoanManagementContext dbContext)
 {
     _dbContext     = dbContext;
     _configuration = configuration;
 }
Ejemplo n.º 6
0
 public MenuController(LoanManagementContext dbContext, IMapper mapper)
 {
     _dbContext = dbContext;
     _mapper    = mapper;
 }