Skip to content
This repository was archived by the owner on Jul 10, 2024. It is now read-only.

Commit 4c1899f

Browse files
committed
Use username for attendees
1 parent 1df8034 commit 4c1899f

File tree

4 files changed

+6
-13
lines changed

4 files changed

+6
-13
lines changed

src/BackEnd/BackEnd.csproj

-9
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,6 @@
55
<UserSecretsId>aspnet-BackEnd-931E56BD-86CB-4A96-BD99-2C6A6ABB0829</UserSecretsId>
66
</PropertyGroup>
77

8-
<ItemGroup>
9-
<Compile Remove="Migrations\20190126203326_Initial.cs" />
10-
<Compile Remove="Migrations\20190126203326_Initial.Designer.cs" />
11-
<Compile Remove="Migrations\20190516071446_Initial.cs" />
12-
<Compile Remove="Migrations\20190516071446_Initial.Designer.cs" />
13-
<Compile Remove="Migrations\20190516072754_Initial.cs" />
14-
<Compile Remove="Migrations\20190516072754_Initial.Designer.cs" />
15-
</ItemGroup>
16-
178
<ItemGroup>
189
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0-preview5*" />
1910
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0-preview5*" />

src/BackEnd/Controllers/AttendeesController.cs

+4-4
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,12 @@ public AttendeesController(ApplicationDbContext db)
2020
_db = db;
2121
}
2222

23-
[HttpGet("{id}")]
24-
public async Task<ActionResult<AttendeeResponse>> Get(string id)
23+
[HttpGet("{username}")]
24+
public async Task<ActionResult<AttendeeResponse>> Get(string username)
2525
{
2626
var attendee = await _db.Attendees.Include(a => a.SessionsAttendees)
2727
.ThenInclude(sa => sa.Session)
28-
.SingleOrDefaultAsync(a => a.UserName == id);
28+
.SingleOrDefaultAsync(a => a.UserName == username);
2929

3030
if (attendee == null)
3131
{
@@ -65,7 +65,7 @@ public async Task<ActionResult<AttendeeResponse>> Post(ConferenceDTO.Attendee in
6565

6666
var result = attendee.MapAttendeeResponse();
6767

68-
return CreatedAtAction(nameof(Get), new { id = result.UserName }, result);
68+
return CreatedAtAction(nameof(Get), new { username = result.UserName }, result);
6969
}
7070

7171
[HttpPost("{username}/session/{sessionId}")]

src/BackEnd/Infrastructure/EntityExtensions.cs

+1
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ public static ConferenceDTO.AttendeeResponse MapAttendeeResponse(this Attendee a
5151
FirstName = attendee.FirstName,
5252
LastName = attendee.LastName,
5353
UserName = attendee.UserName,
54+
EmailAddress = attendee.EmailAddress,
5455
Sessions = attendee.SessionsAttendees?
5556
.Select(sa =>
5657
new ConferenceDTO.Session

src/FrontEnd/FrontEnd.csproj

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.0.0-preview5*" />
1010
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="3.0.0-preview5*" />
1111
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.0.0-preview5*" />
12+
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0-preview5*" />
1213
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0-preview5*" />
1314
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0-preview5*" />
1415
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="3.0.0-preview5*" />

0 commit comments

Comments
 (0)