From 4c1899f44545205042a6d440a2ed5e218b6f4b2c Mon Sep 17 00:00:00 2001 From: David Fowler Date: Thu, 16 May 2019 01:10:39 -0700 Subject: [PATCH] Use username for attendees --- src/BackEnd/BackEnd.csproj | 9 --------- src/BackEnd/Controllers/AttendeesController.cs | 8 ++++---- src/BackEnd/Infrastructure/EntityExtensions.cs | 1 + src/FrontEnd/FrontEnd.csproj | 1 + 4 files changed, 6 insertions(+), 13 deletions(-) diff --git a/src/BackEnd/BackEnd.csproj b/src/BackEnd/BackEnd.csproj index fec8b721..50762a6d 100644 --- a/src/BackEnd/BackEnd.csproj +++ b/src/BackEnd/BackEnd.csproj @@ -5,15 +5,6 @@ aspnet-BackEnd-931E56BD-86CB-4A96-BD99-2C6A6ABB0829 - - - - - - - - - diff --git a/src/BackEnd/Controllers/AttendeesController.cs b/src/BackEnd/Controllers/AttendeesController.cs index 43241435..840e29c5 100644 --- a/src/BackEnd/Controllers/AttendeesController.cs +++ b/src/BackEnd/Controllers/AttendeesController.cs @@ -20,12 +20,12 @@ public AttendeesController(ApplicationDbContext db) _db = db; } - [HttpGet("{id}")] - public async Task> Get(string id) + [HttpGet("{username}")] + public async Task> 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) { @@ -65,7 +65,7 @@ public async Task> 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}")] diff --git a/src/BackEnd/Infrastructure/EntityExtensions.cs b/src/BackEnd/Infrastructure/EntityExtensions.cs index d148a4d9..36635121 100644 --- a/src/BackEnd/Infrastructure/EntityExtensions.cs +++ b/src/BackEnd/Infrastructure/EntityExtensions.cs @@ -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 diff --git a/src/FrontEnd/FrontEnd.csproj b/src/FrontEnd/FrontEnd.csproj index 30eae296..13a08c39 100644 --- a/src/FrontEnd/FrontEnd.csproj +++ b/src/FrontEnd/FrontEnd.csproj @@ -9,6 +9,7 @@ +