forked from orcasound/aifororcas-livesystem
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SubscriberEmail.cs
36 lines (34 loc) · 1.25 KB
/
SubscriberEmail.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.Cosmos.Table;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Extensions.Logging;
using NotificationSystem.Models;
using NotificationSystem.Utilities;
namespace NotificationSystem
{
[StorageAccount("OrcaNotificationStorageSetting")]
public static class SubscriberEmail
{
[FunctionName("SubscribeToSubscriberEmail")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "post", "delete")] HttpRequest req,
[Table("EmailList")] CloudTable cloudTable,
ILogger log)
{
return await EmailHelpers.UpdateEmailList<SubscriberEmailEntity>(req, cloudTable, log);
}
[FunctionName("ListSubscriberEmails")]
public static IEnumerable<string> List(
[HttpTrigger(AuthorizationLevel.Function, "get")] HttpRequest req,
[Table("EmailList")] CloudTable cloudTable,
ILogger log)
{
return EmailHelpers.GetEmailEntities(cloudTable, "Subscriber").Select(e => e.Email);
}
}
}