This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
lottoDate: "Saturday, March 21 2015 " | |
lottoBalls: [6] | |
0: "13" | |
1: "21" | |
2: "24" | |
3: "38" | |
4: "48" | |
5: "6" | |
- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class SmsService : IIdentityMessageService | |
{ | |
public async Task SendAsync(IdentityMessage message) | |
{ | |
using (var httpClient = new HttpClient()) | |
{ | |
var result = await httpClient.GetStringAsync($"http://whatsapp2fa.azurewebsites.net/api/SendCode?code={message.Body}&number={message.Destination}&token={token}"); | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static List<string> GetSubjectAlternativeNames(this X509Certificate2 certificate) | |
{ | |
foreach (X509Extension extension in certificate.Extensions) | |
{ | |
// Create an AsnEncodedData object using the extensions information. | |
AsnEncodedData asndata = new AsnEncodedData(extension.Oid, extension.RawData); | |
if (string.Equals(extension.Oid.FriendlyName, "Subject Alternative Name")) | |
{ | |
//Console.WriteLine("Extension type: {0}", extension.Oid.FriendlyName); | |
//Console.WriteLine("Oid value: {0}", asndata.Oid.Value); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Path needed for the ability to call this project in an ASP.NET project. | |
var codeBase = Assembly.GetExecutingAssembly().CodeBase; | |
var codeBaseUri = new UriBuilder(codeBase); | |
var uriPath = Uri.UnescapeDataString(codeBaseUri.Path); | |
var dirPath = Path.GetDirectoryName(uriPath); | |
// ResolvePathTemplateManager with no caching. | |
_razorEngineService = RazorEngine.Templating.RazorEngineService.Create(new TemplateServiceConfiguration | |
{ | |
TemplateManager = new ResolvePathTemplateManager(new[] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@using Example.Email | |
@using RazorEngine | |
@using Example.Email.EmailViewModels | |
@inherits RazorEngine.Templating.TemplateBase<WelcomeEmailTemplate> | |
<html xmlns:v="urn:schemas-microsoft-com:vml" dir="ltr" lang="en"> | |
@Include("_Head.cshtml") | |
<body bgcolor="#ffffff" style="-moz-osx-font-smoothing: always; -webkit-appearance: none; -webkit-font-smoothing: antialiased; font-smooth: always; -webkit-text-size-adjust: 100%; -moz-text-size-adjust: 100%; -ms-text-size-adjust: 100%; text-size-adjust: 100%; width: 100%; margin: 0; padding: 0;"> | |
<!-- start of #email-bg --> | |
<table width="100%" border="0" class="email-bg" style="font-family: Helvetica, Arial, Sans-Serif; border-collapse: collapse; border-spacing: 0; mso-table-lspace: 0pt; mso-table-rspace: 0pt; border: none;" cellpadding="0" cellspacing="0"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var welcomeEmailTemplateModel = new WelcomeEmailTemplate(); | |
var emailHtmlBody = await EmailTemplateHelper.RenderEmailTemplate<WelcomeEmailTemplate>(welcomeEmailTemplateModel); | |
/// <summary> | |
/// Renders HTML from email template view model passed in. | |
/// </summary> | |
/// <typeparam name="TEmailTemplate">The element type of the email template view model.</typeparam> | |
/// <param name="model">Email template view model.</param> | |
/// <returns>String of HTML.</returns> | |
public static async Task<string> RenderEmailTemplate<TEmailTemplate>(TEmailTemplate model) where TEmailTemplate : IEmailTemplateBase |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var emailHtmlBody = await EmailTemplateHelper.RenderEmailTemplate<WelcomeEmailTemplate>(welcomeEmailTemplateModel); | |
var emailPlainTextBody = await EmailTemplateHelper.ConvertHtmlEmailTemplateToPlainText(emailHtmlBody); | |
/// <summary> | |
/// Converts HTML email template to plain text. | |
/// </summary> | |
/// <param name="html"></param> | |
/// <returns></returns> | |
public static async Task<string> ConvertHtmlEmailTemplateToPlainText(string html) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@using RazorEngine | |
@using Example.Email | |
@inherits RazorEngine.Templating.TemplateBase<EmailTemplateBase> | |
<div itemscope="" itemtype="http://schema.org/EmailMessage" style="display:none"><div itemprop="action" itemscope="" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="@Model.GoogleGoToActionUrl"><meta itemprop="name" content="@Model.Preheader"></div><meta itemprop="description" content="@Model.Preheader"></div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Get tables and their columns | |
var databaseTableInfo = GetDatabaseTableInfo(); | |
AppDomain domain = AppDomain.CurrentDomain; | |
AssemblyName aName = new AssemblyName("Example.DynamicMapping.DynamicDatabaseMapping"); | |
AssemblyBuilder ab = domain.DefineDynamicAssembly(aName, AssemblyBuilderAccess.Save); | |
System.Reflection.Emit.ModuleBuilder mb = ab.DefineDynamicModule(aName.Name, aName.Name + ".dll"); | |
// Define mapping static class of the database | |
TypeBuilder typeDatabaseModel = mb.DefineType("Example.DynamicMapping.DynamicDatabaseMapping.DatabaseModels.DatabaseMapping", TypeAttributes.Public | TypeAttributes.Abstract | TypeAttributes.Sealed); |
OlderNewer