-
Notifications
You must be signed in to change notification settings - Fork 2
/
ProcessCCApplication.cs
33 lines (29 loc) · 1021 Bytes
/
ProcessCCApplication.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
using System;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Host;
using Newtonsoft.Json;
namespace LearnAzureFunctions
{
public static class ProcessCCApplication
{
[FunctionName("ProcessCCApplication")]
public static void Run([QueueTrigger("ccapplication", Connection = "")]CCApplication ccApplication,
[Blob("accepted-application/{rand-guid}")] out string acceptedCCApplication,
[Blob("rejected-application/{rand-guid}")] out string rejectedCCApplication,
TraceWriter log)
{
log.Info($"C# Queue trigger function processed: {ccApplication.Name}");
bool isApplicationAccepted = ccApplication.YearlyIncome > 100000 && ccApplication.Age > 23;
if (isApplicationAccepted)
{
acceptedCCApplication = JsonConvert.SerializeObject(ccApplication);
rejectedCCApplication = null;
}
else
{
rejectedCCApplication = JsonConvert.SerializeObject(ccApplication);
acceptedCCApplication = null;
}
}
}
}