Compare commits
9 Commits
bc3a05ebf9
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 5e0d1cce20 | |||
| 069b503339 | |||
| 829cfeefcf | |||
| 1f95c0d0b6 | |||
| 94d1796213 | |||
| 9ebc82fe62 | |||
| f41b2ae005 | |||
| 64fa9e1823 | |||
| cf175649a0 |
@@ -22,7 +22,8 @@ namespace PizzaExpress.Controllers
|
||||
{
|
||||
var list = await _ctx.Pizze.AsNoTracking().ToListAsync();
|
||||
// wrapper come nell'esempio Java { "pizze": [...] }
|
||||
return Ok(new { pizze = list });
|
||||
//return Ok(new { pizze = list });
|
||||
return Ok(list);
|
||||
}
|
||||
|
||||
// GET: /api/pizze/{id} (JSON o XML in base all'header Accept)
|
||||
@@ -46,13 +47,18 @@ namespace PizzaExpress.Controllers
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
// PUT: /api/pizze/{id} Body: { "prezzo": 4.70 }
|
||||
// PUT: /api/pizze/{id}
|
||||
[HttpPut("{id:int}")]
|
||||
public async Task<IActionResult> UpdatePrezzo(int id, [FromBody] PrezzoUpdate body)
|
||||
public async Task<IActionResult> UpdatePizza(int id, [FromBody] Pizza body)
|
||||
{
|
||||
var pizza = await _ctx.Pizze.FindAsync(id);
|
||||
if (pizza is null) return NotFound();
|
||||
pizza.Nome = body.Nome;
|
||||
pizza.Prezzo = body.Prezzo;
|
||||
pizza.Categoria = body.Categoria;
|
||||
pizza.Note = body.Note;
|
||||
pizza.Tavolo = body.Tavolo;
|
||||
pizza.Stato = body.Stato;
|
||||
await _ctx.SaveChangesAsync();
|
||||
return NoContent();
|
||||
}
|
||||
|
||||
@@ -5,5 +5,9 @@
|
||||
public int Id { get; set; }
|
||||
public string Nome { get; set; } = string.Empty;
|
||||
public decimal Prezzo { get; set; }
|
||||
public string Categoria { get; set; } = string.Empty;
|
||||
public string Note { get; set; } = string.Empty;
|
||||
public int Tavolo { get; set; }
|
||||
public string Stato { get; set; } = string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<ActiveDebugProfile>http</ActiveDebugProfile>
|
||||
<ActiveDebugProfile>https</ActiveDebugProfile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||
<DebuggerFlavor>ProjectDebugger</DebuggerFlavor>
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||
},
|
||||
"dotnetRunMessages": true,
|
||||
"applicationUrl": "http://localhost:5011"
|
||||
"applicationUrl": "http://localhost:5000"
|
||||
},
|
||||
"https": {
|
||||
"commandName": "Project",
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user