Repository navigation
Expand file tree
/
Copy pathDemoEntrySeedHelper.cs
More file actions
57 lines (50 loc) · 1.66 KB
/
Copy pathDemoEntrySeedHelper.cs
File metadata and controls
57 lines (50 loc) · 1.66 KB
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
using BlazorWebForms.Core.Models;
namespace BlazorWebForms.Infrastructure.SqlServer;
internal static class DemoEntrySeedHelper
{
public static EntryEntity CreateDemoEntry(Guid formId, Guid formVersionId)
{
var entry = new EntryEntity
{
FormId = formId,
FormVersionId = formVersionId,
SubmittedBy = "Taylor Submitter",
SubmittedByEmail = "taylor@example.com",
Status = (int)EntryStatus.NeedsApproval,
SubmittedUtc = DateTimeOffset.UtcNow
};
entry.SearchIndex = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase)
{
["employeeName"] = "Taylor Submitter",
["destination"] = "Phoenix"
};
entry.Revisions.Add(new EntryRevisionEntity
{
RevisionNumber = 1,
EditedBy = "Taylor Submitter",
EditedUtc = entry.SubmittedUtc,
Answers = new Dictionary<string, string?>(StringComparer.OrdinalIgnoreCase)
{
["employeeName"] = "Taylor Submitter",
["destination"] = "Phoenix"
}
});
entry.ApprovalSteps.Add(new ApprovalStepEntity
{
Order = 1,
ApproverName = "Casey Manager",
ApproverEmail = "casey@example.com",
Status = (int)ApprovalStepStatus.Pending
});
foreach (var kv in entry.SearchIndex)
{
entry.SearchIndexEntries.Add(new EntrySearchIndexEntity
{
Id = Guid.NewGuid(),
Key = kv.Key,
Value = kv.Value
});
}
return entry;
}
}