This commit is contained in:
Elias Jansson
2023-01-31 14:16:18 +01:00
parent 63e25fcf84
commit 156124534b
3 changed files with 20 additions and 7 deletions

View File

@@ -23,9 +23,16 @@ namespace Nevyn.Controllers
// GET: api/ShoppingLists
[HttpGet]
public async Task<ActionResult<IEnumerable<WalletDTO>>> GetWallet()
public async Task<ActionResult<WalletDTO>> GetWallet()
{
return await _context.UpdateWallet.Select(x => ItemToDTO(x)).ToListAsync();
Wallet wallet = await _context.UpdateWallet.FindAsync(1);
if (wallet == null)
{
wallet = new Wallet();
wallet.updateFromDatabase();
}
return ItemToDTO(wallet);
}
// GET: api/ShoppingLists/5