Skip to content

Commit

Permalink
better checking on GetByName
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasdaquina committed Jul 26, 2024
1 parent 02a5b22 commit 6850814
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/SM.Medication.Api/EndPoints/MedicationEndPoints.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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!"))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ public async Task<bool> 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()));
}
}

0 comments on commit 6850814

Please sign in to comment.