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

Commit

Permalink
Use username for attendees
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfowl committed May 16, 2019
1 parent 1df8034 commit 4c1899f
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 13 deletions.
9 changes: 0 additions & 9 deletions src/BackEnd/BackEnd.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,6 @@
<UserSecretsId>aspnet-BackEnd-931E56BD-86CB-4A96-BD99-2C6A6ABB0829</UserSecretsId>
</PropertyGroup>

<ItemGroup>
<Compile Remove="Migrations\20190126203326_Initial.cs" />
<Compile Remove="Migrations\20190126203326_Initial.Designer.cs" />
<Compile Remove="Migrations\20190516071446_Initial.cs" />
<Compile Remove="Migrations\20190516071446_Initial.Designer.cs" />
<Compile Remove="Migrations\20190516072754_Initial.cs" />
<Compile Remove="Migrations\20190516072754_Initial.Designer.cs" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.0.0-preview5*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0-preview5*" />
Expand Down
8 changes: 4 additions & 4 deletions src/BackEnd/Controllers/AttendeesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ public AttendeesController(ApplicationDbContext db)
_db = db;
}

[HttpGet("{id}")]
public async Task<ActionResult<AttendeeResponse>> Get(string id)
[HttpGet("{username}")]
public async Task<ActionResult<AttendeeResponse>> Get(string username)
{
var attendee = await _db.Attendees.Include(a => a.SessionsAttendees)
.ThenInclude(sa => sa.Session)
.SingleOrDefaultAsync(a => a.UserName == id);
.SingleOrDefaultAsync(a => a.UserName == username);

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

var result = attendee.MapAttendeeResponse();

return CreatedAtAction(nameof(Get), new { id = result.UserName }, result);
return CreatedAtAction(nameof(Get), new { username = result.UserName }, result);
}

[HttpPost("{username}/session/{sessionId}")]
Expand Down
1 change: 1 addition & 0 deletions src/BackEnd/Infrastructure/EntityExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ public static ConferenceDTO.AttendeeResponse MapAttendeeResponse(this Attendee a
FirstName = attendee.FirstName,
LastName = attendee.LastName,
UserName = attendee.UserName,
EmailAddress = attendee.EmailAddress,
Sessions = attendee.SessionsAttendees?
.Select(sa =>
new ConferenceDTO.Session
Expand Down
1 change: 1 addition & 0 deletions src/FrontEnd/FrontEnd.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<PackageReference Include="Microsoft.AspNetCore.Diagnostics.EntityFrameworkCore" Version="3.0.0-preview5*" />
<PackageReference Include="Microsoft.AspNetCore.Identity.UI" Version="3.0.0-preview5*" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="3.0.0-preview5*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Tools" Version="3.0.0-preview5*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0-preview5*" />
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="3.0.0-preview5*" />
<PackageReference Include="Microsoft.Extensions.Diagnostics.HealthChecks.EntityFrameworkCore" Version="3.0.0-preview5*" />
Expand Down

0 comments on commit 4c1899f

Please sign in to comment.