From 6850814914eb9d977a0d4686ab053c0eac8520a9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucas=20D=C3=A1quina?= Date: Fri, 26 Jul 2024 17:18:02 +0200 Subject: [PATCH] better checking on GetByName --- src/SM.Medication.Api/EndPoints/MedicationEndPoints.cs | 2 +- .../Services/Repositories/MedicationRepository.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/SM.Medication.Api/EndPoints/MedicationEndPoints.cs b/src/SM.Medication.Api/EndPoints/MedicationEndPoints.cs index 1f60b56..d0cc255 100644 --- a/src/SM.Medication.Api/EndPoints/MedicationEndPoints.cs +++ b/src/SM.Medication.Api/EndPoints/MedicationEndPoints.cs @@ -46,7 +46,7 @@ public static RouteHandlerBuilder AddMetadata(this RouteHandlerBuilder builder, { return builder.WithTags(MEDICATION_TAG) .WithMetadata(new SwaggerOperationAttribute(MEDICATION_TAG, description)) - .WithMetadata(new SwaggerResponseAttribute(StatusCodes.Status201Created, "Success!")) + .WithMetadata(new SwaggerResponseAttribute(StatusCodes.Status201Created, "Created!")) .WithMetadata(new SwaggerResponseAttribute(StatusCodes.Status400BadRequest, "Bad Request!")) .WithMetadata(new SwaggerResponseAttribute(StatusCodes.Status401Unauthorized, "You're not Authorized!")) .WithMetadata(new SwaggerResponseAttribute(StatusCodes.Status500InternalServerError, "Failed!")) diff --git a/src/SM.Medication.Infrastructure/Services/Repositories/MedicationRepository.cs b/src/SM.Medication.Infrastructure/Services/Repositories/MedicationRepository.cs index b6891d9..4bdb82a 100644 --- a/src/SM.Medication.Infrastructure/Services/Repositories/MedicationRepository.cs +++ b/src/SM.Medication.Infrastructure/Services/Repositories/MedicationRepository.cs @@ -25,6 +25,6 @@ public async Task Add(Domain.Entities.Medication entity) { return await context .Medications - .FirstOrDefaultAsync(x => x.Name!.ToUpperInvariant().Trim() == name.ToUpperInvariant().Trim()); + .FirstOrDefaultAsync(med => string.Equals(med.Name!.ToUpper(), name.ToUpper())); } }