Skip to content

Commit

Permalink
corrected api route for some minimal api scenarios (#2403)
Browse files Browse the repository at this point in the history
  • Loading branch information
deepchoudhery authored May 11, 2023
1 parent b0d26d3 commit 892f248
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
string endPointsClassName = Model.EndpointsName;
string methodName = $"Map{@modelName}Endpoints";
string pluralModel = Model.ModelType.PluralName;
string routePrefixPlural = "/api/" + pluralModel;
string getAllModels = $"GetAll{@pluralModel}";
string getModelById = $"Get{@modelName}ById";
string deleteModel = $"Delete{@modelName}";
Expand Down Expand Up @@ -94,11 +95,11 @@ public static class @endPointsClassName
@{
if(!Model.UseTypedResults)
{
@://return Results.Created($"/@pluralModel/{model.ID}", model);
@://return Results.Created($"@routePrefixPlural/{model.ID}", model);
}
else
{
@://return TypedResults.Created($"/@pluralModel/{model.ID}", model);
@://return TypedResults.Created($"@routePrefixPlural/{model.ID}", model);
}
}
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
string endPointsClassName = Model.EndpointsName;
string methodName = $"Map{@modelName}Endpoints";
string pluralModel = Model.ModelType.PluralName;
string routePrefixPlural = "/api/" + pluralModel;
string getAllModels = $"GetAll{@pluralModel}";
string getModelById = $"Get{@modelName}ById";
string deleteModel = $"Delete{@modelName}";
Expand Down Expand Up @@ -85,11 +86,11 @@
@{
if(!Model.UseTypedResults)
{
@://return Results.Created($"/@pluralModel/{model.ID}", model);
@://return Results.Created($"@routePrefixPlural/{model.ID}", model);
}
else
{
@://return TypedResults.Created($"/@pluralModel/{model.ID}", model);
@://return TypedResults.Created($"@routePrefixPlural/{model.ID}", model);
}
}
})
Expand Down

0 comments on commit 892f248

Please sign in to comment.