19 Commits
0.1.2 ... main

Author SHA1 Message Date
5e0d1cce20 Cambio porta server Kestrel in configurazione debug HTTP a 5000 2026-02-05 09:16:15 +01:00
069b503339 Fix funzione PUT (modifica altri campi oltre al prezzo) 2026-02-05 08:54:38 +01:00
829cfeefcf Fix funzione get pizze per implementazione su client winforms vibecodato da Di Campi 2026-01-22 09:24:26 +01:00
1f95c0d0b6 Fix database d'esempio 2026-01-22 08:53:05 +01:00
94d1796213 Aggiornamento DB di esempio 2026-01-15 09:33:08 +01:00
9ebc82fe62 Aggiunta campi nel modello Pizza 2026-01-15 09:24:01 +01:00
f41b2ae005 Modifiche database di esempio per compatibilità 2025-12-04 09:23:17 +01:00
64fa9e1823 Aggiunta campo "Note" 2025-12-04 09:22:47 +01:00
cf175649a0 Passaggio a profilo HTTPS in ambiente dev 2025-12-04 09:22:00 +01:00
bc3a05ebf9 Merge del branch di implementazione SQLite
Reviewed-on: SmerdoRepository/PizzaExpress#1
2025-11-26 07:52:32 +00:00
e5a6e81881 Aggiunta database di esempio 2025-11-26 08:50:11 +01:00
c8e5c403fb Rimozione creazione entry automatica all'esecuzione (può creare problemi) 2025-11-26 08:47:00 +01:00
07044d6156 Aggiustamento ignore database in gitignore 2025-11-26 08:45:45 +01:00
366fad3241 Implementazione database SQLite in Program.cs 2025-11-26 08:38:11 +01:00
0eecf829e1 Aggiunta database a gitignore 2025-11-26 08:37:53 +01:00
e04b85fa30 Rimozione libreria InMemory e cambio versione libreria Sqlite 2025-11-26 08:24:00 +01:00
6dcdbea46b Replaced Microsoft.Data.Sqlite with Microsoft.EntityFrameworkCore.Sqlite 2025-11-26 08:19:54 +01:00
c69cc287b6 Aggiornamento librerie 2025-11-26 08:05:05 +01:00
d258ea4615 Installazione libreria SQLite 2025-11-26 08:03:47 +01:00
9 changed files with 29 additions and 21 deletions

3
.gitignore vendored
View File

@@ -53,4 +53,5 @@ CodeCoverage/
TestResult.xml
nunit-*.xml
.vs/
.vs/
pizza.db*

View File

@@ -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();
}

View File

@@ -18,14 +18,6 @@ namespace PizzaExpress.Data
public static void Initialize(PizzaContext ctx)
{
if (ctx.Pizze.Any()) return;
ctx.Pizze.AddRange(
new Pizza { Id = 1, Nome = "Margherita", Prezzo = 4.50m },
new Pizza { Id = 2, Nome = "Prosciutto", Prezzo = 5.00m },
new Pizza { Id = 3, Nome = "Capricciosa", Prezzo = 7.00m }
);
ctx.SaveChanges();
}
}
}

View File

@@ -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;
}
}

View File

@@ -9,9 +9,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.InMemory" Version="9.0.10" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.21.0" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.4.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="9.0.11" />
<PackageReference Include="Microsoft.VisualStudio.Azure.Containers.Tools.Targets" Version="1.22.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="10.0.1" />
</ItemGroup>
<ItemGroup>

View File

@@ -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>

View File

@@ -30,9 +30,10 @@ namespace PizzaExpress
builder.Services.AddControllers()
.AddXmlSerializerFormatters();
// DB in memory perch<63> siamo froci
// Creazione del contesto con DB SQLite
builder.Services.AddDbContext<PizzaContext>(opt =>
opt.UseInMemoryDatabase("dbpizze"));
opt.UseSqlite("Data Source=pizza.db"));
// Learn more about configuring Swagger/OpenAPI at https://aka.ms/aspnetcore/swashbuckle
builder.Services.AddEndpointsApiExplorer();
@@ -40,9 +41,11 @@ namespace PizzaExpress
var app = builder.Build();
using (var porcoidddioooo = app.Services.CreateScope())
using (var scope = app.Services.CreateScope())
{
var ctx = porcoidddioooo.ServiceProvider.GetRequiredService<PizzaContext>();
var ctx = scope.ServiceProvider.GetRequiredService<PizzaContext>();
// Crea il DB e le tabelle basate sul modello se non esistono (no migrations)
ctx.Database.EnsureCreated();
SeedData.Initialize(ctx);
}
@@ -56,6 +59,8 @@ namespace PizzaExpress
app.MapControllers();
app.Run();
}
}

View File

@@ -8,7 +8,7 @@
"ASPNETCORE_ENVIRONMENT": "Development"
},
"dotnetRunMessages": true,
"applicationUrl": "http://localhost:5011"
"applicationUrl": "http://localhost:5000"
},
"https": {
"commandName": "Project",

Binary file not shown.