File tree Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Expand file tree Collapse file tree 2 files changed +15
-6
lines changed Original file line number Diff line number Diff line change @@ -12,7 +12,7 @@ public static void UseSqlAsStorageProvider(this IServiceCollection services)
12
12
{
13
13
services . AssertNotAlreadyRegistered ( typeof ( IRepository < > ) ) ;
14
14
15
- services . AddScoped ( s =>
15
+ services . AddTransient ( s =>
16
16
{
17
17
var configuration = s . GetService < AppConfiguration > ( ) ?? throw new NullReferenceException ( nameof ( AppConfiguration ) ) ;
18
18
var connectionString = configuration . ConnectionString ;
@@ -29,7 +29,7 @@ public static void UseSqliteAsStorageProvider(this IServiceCollection services)
29
29
{
30
30
services . AssertNotAlreadyRegistered ( typeof ( IRepository < > ) ) ;
31
31
32
- services . AddScoped ( s =>
32
+ services . AddTransient ( s =>
33
33
{
34
34
var configuration = s . GetService < AppConfiguration > ( ) ?? throw new NullReferenceException ( nameof ( AppConfiguration ) ) ;
35
35
var connectionString = configuration . ConnectionString ;
Original file line number Diff line number Diff line change 1
1
@using LinkDotNet .Domain
2
+ @using LinkDotNet .Infrastructure .Persistence
3
+ @inject IRepository <Skill > repository
2
4
<div class =" skill-table-container" >
3
5
<div >
4
6
@if (IsAuthenticated )
59
61
60
62
private Skill currentDragItem ;
61
63
62
- private Task AddSkill (Skill skillToAdd )
64
+ protected override async Task OnInitializedAsync ()
65
+ {
66
+ skills = (await repository .GetAllAsync ()).ToList ();
67
+ }
68
+
69
+ private async Task AddSkill (Skill skillToAdd )
63
70
{
64
71
skills .Add (skillToAdd );
65
- return Task . CompletedTask ;
72
+ await repository . StoreAsync ( skillToAdd ) ;
66
73
}
67
74
68
- private void DeleteSkill (Skill skill )
75
+ private async Task DeleteSkill (Skill skill )
69
76
{
70
77
skills .Remove (skill );
78
+ await repository .DeleteAsync (skill .Id );
71
79
}
72
80
73
- private void HandleDrop (ProficiencyLevel proficiencyLevel )
81
+ private async Task HandleDrop (ProficiencyLevel proficiencyLevel )
74
82
{
75
83
if (currentDragItem == null || currentDragItem .ProficiencyLevel == proficiencyLevel )
76
84
{
77
85
return ;
78
86
}
79
87
80
88
currentDragItem .ProficiencyLevel = proficiencyLevel ;
89
+ await repository .StoreAsync (currentDragItem );
81
90
currentDragItem = null ;
82
91
}
83
92
You can’t perform that action at this time.
0 commit comments