отключил модераторов
This commit is contained in:
parent
67e5d51014
commit
7d4edb6caa
@ -10,7 +10,7 @@ public static class WeatherForecastEndpointsExtensions
|
||||
{
|
||||
var group = app.MapGroup("weatherforecast");
|
||||
group.MapGet(string.Empty, async (WeatherForecastContext db) => await db.Forecasts.ToListAsync());
|
||||
group.MapDelete("{id}", [Authorize(Roles="moderator")]async (WeatherForecastContext db, int id) =>
|
||||
group.MapDelete("{id}", [Authorize]async (WeatherForecastContext db, int id) =>
|
||||
{
|
||||
var forecast = await db.Forecasts.FindAsync(id);
|
||||
if (forecast == null)
|
||||
@ -23,14 +23,14 @@ public static class WeatherForecastEndpointsExtensions
|
||||
|
||||
return Results.NoContent();
|
||||
});
|
||||
group.MapPost(string.Empty, [Authorize(Roles="moderator")] async (WeatherForecastContext db, WeatherForecast forecast) =>
|
||||
group.MapPost(string.Empty, [Authorize] async (WeatherForecastContext db, WeatherForecast forecast) =>
|
||||
{
|
||||
db.Forecasts.Add(forecast);
|
||||
await db.SaveChangesAsync();
|
||||
|
||||
return Results.Created($"/weatherforecast/{forecast.Id}", forecast);
|
||||
});
|
||||
group.MapPut("{id}", [Authorize(Roles="moderator")] async (WeatherForecastContext db, int id, WeatherForecast forecast) =>
|
||||
group.MapPut("{id}", [Authorize] async (WeatherForecastContext db, int id, WeatherForecast forecast) =>
|
||||
{
|
||||
if (id != forecast.Id)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user