Added a route to get a summary of all currencies

This commit is contained in:
2023-08-19 18:25:17 -04:00
parent ff327d0a03
commit 1fedd4d016
7 changed files with 58 additions and 12 deletions

View File

@ -3,6 +3,7 @@ using IO.Swagger.Models.dto;
using IO.Swagger.Services;
using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@ -17,6 +18,11 @@ namespace IO.Swagger.Repositories
this.context = context ?? throw new ArgumentNullException(nameof(context));
}
public async Task<List<Currency>> GetAllCurrencies()
{
return await context.Currencies.Include(c => c.User).Include(c=>c.Transactions).ToListAsync();
}
public async Task<bool> CreateCurrency(CurrencyCreateBody request, int userId)
{
request.Symbol = request.Symbol.Trim();