diff --git a/Server/ReasnAPI/ReasnAPI.Tests/Services/ParticipantServiceTests.cs b/Server/ReasnAPI/ReasnAPI.Tests/Services/ParticipantServiceTests.cs index 9104800..8537a80 100644 --- a/Server/ReasnAPI/ReasnAPI.Tests/Services/ParticipantServiceTests.cs +++ b/Server/ReasnAPI/ReasnAPI.Tests/Services/ParticipantServiceTests.cs @@ -188,7 +188,7 @@ public void CreateParticipant_ParticipantCreated_ParticipantReturned() Status = ParticipantStatus.Interested }; - var result = participantService.CreateUpdateParticipant(participantDto); + var result = participantService.CreateOrUpdateParticipant(participantDto); Assert.IsNotNull(result); Assert.AreEqual("Event-Slug", result.EventSlug); @@ -204,7 +204,7 @@ public void CreateParticipant_ParticipantDtoIsNull_NullReturned() var participantService = new ParticipantService(mockContext.Object); - Assert.ThrowsException(() => participantService.CreateUpdateParticipant(null)); + Assert.ThrowsException(() => participantService.CreateOrUpdateParticipant(null)); } [TestMethod] @@ -242,7 +242,7 @@ public void UpdateParticipant_ParticipantExists_ParticipantReturned() var participantService = new ParticipantService(mockContext.Object); - var result = participantService.CreateUpdateParticipant(new ParticipantDto + var result = participantService.CreateOrUpdateParticipant(new ParticipantDto { EventSlug = "Event-Slug", Username = "Username", @@ -265,7 +265,7 @@ public void UpdateParticipant_ParticipantDoesNotExist_NullReturned() var participantService = new ParticipantService(mockContext.Object); - Assert.ThrowsException(() => participantService.CreateUpdateParticipant(new ParticipantDto + Assert.ThrowsException(() => participantService.CreateOrUpdateParticipant(new ParticipantDto { EventSlug = "Event-Slug", Username = "Username", @@ -283,7 +283,7 @@ public void UpdateParticipant_ParticipantDtoIsNull_NullReturned() var participantService = new ParticipantService(mockContext.Object); - Assert.ThrowsException(() => participantService.CreateUpdateParticipant(null)); + Assert.ThrowsException(() => participantService.CreateOrUpdateParticipant(null)); } [TestMethod] diff --git a/Server/ReasnAPI/ReasnAPI/Controllers/MeController.cs b/Server/ReasnAPI/ReasnAPI/Controllers/MeController.cs index 05108a1..66ef603 100644 --- a/Server/ReasnAPI/ReasnAPI/Controllers/MeController.cs +++ b/Server/ReasnAPI/ReasnAPI/Controllers/MeController.cs @@ -54,7 +54,7 @@ public IActionResult UpdateCurrentUser( public IActionResult GetCurrentUserImage() { var user = _userService.GetCurrentUser(); - var image = _imageService.GetImagesByUserId(user.Id); + var image = _imageService.GetImageByUserId(user.Id); if (image is null) { @@ -151,7 +151,7 @@ public IActionResult EnrollCurrentUserInEvent([FromRoute] string slug) { var user = _userService.GetCurrentUser(); - var participant = _participantService.CreateUpdateParticipant(new ParticipantDto { EventSlug = slug, Username = user.Username, Status = ParticipantStatus.Interested }); + var participant = _participantService.CreateOrUpdateParticipant(new ParticipantDto { EventSlug = slug, Username = user.Username, Status = ParticipantStatus.Interested }); var location = Url.Action( action: nameof(GetCurrentUserEvents), @@ -166,7 +166,7 @@ public IActionResult EnrollCurrentUserInEvent([FromRoute] string slug) public IActionResult ConfirmCurrentUserEventAttendance([FromRoute] string slug) { var user = _userService.GetCurrentUser(); - var participant = _participantService.CreateUpdateParticipant(new ParticipantDto { EventSlug = slug, Username = user.Username, Status = ParticipantStatus.Participating }); + var participant = _participantService.CreateOrUpdateParticipant(new ParticipantDto { EventSlug = slug, Username = user.Username, Status = ParticipantStatus.Participating }); return Ok(participant); } diff --git a/Server/ReasnAPI/ReasnAPI/Services/ImageService.cs b/Server/ReasnAPI/ReasnAPI/Services/ImageService.cs index df47dde..f911fe1 100644 --- a/Server/ReasnAPI/ReasnAPI/Services/ImageService.cs +++ b/Server/ReasnAPI/ReasnAPI/Services/ImageService.cs @@ -174,7 +174,7 @@ public ImageDto GetImageById(int id) return imageDto; } - public ImageDto GetImagesByUserId(int userId) + public ImageDto GetImageByUserId(int userId) { var image = context.Images.FirstOrDefault(image => image.ObjectId == userId && image.ObjectType == ObjectType.User); diff --git a/Server/ReasnAPI/ReasnAPI/Services/ParticipantService.cs b/Server/ReasnAPI/ReasnAPI/Services/ParticipantService.cs index 865f597..481bcb5 100644 --- a/Server/ReasnAPI/ReasnAPI/Services/ParticipantService.cs +++ b/Server/ReasnAPI/ReasnAPI/Services/ParticipantService.cs @@ -9,7 +9,7 @@ namespace ReasnAPI.Services; public class ParticipantService(ReasnContext context) { - public ParticipantDto CreateUpdateParticipant(ParticipantDto participantDto) + public ParticipantDto CreateOrUpdateParticipant(ParticipantDto participantDto) { ArgumentNullException.ThrowIfNull(participantDto);