implemented getting all quotes

This commit is contained in:
StevanFreeborn
2022-06-23 13:26:21 -05:00
parent 2cbab773d0
commit 7e778d6154
2 changed files with 17 additions and 12 deletions
+3 -3
View File
@@ -44,10 +44,10 @@ namespace server.Controllers.v1
}
}
// TODO
// TODO: Implement getquotesbyid
[MapToApiVersion("1.0")]
[HttpGet]
public async Task<ActionResult<Quote>> GetQuoteByIdAsync(int id)
[HttpGet("{id:int}")]
public Task<ActionResult<Quote>> GetQuoteByIdAsync(int id)
{
throw new NotImplementedException();
}
@@ -1,9 +1,5 @@
using server.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using MongoDB.Driver;
using server.Models;
namespace server.Persistence.Repositories
{
@@ -16,10 +12,19 @@ namespace server.Persistence.Repositories
_context = context;
}
// TODO: Implement GetQuotesAsync() method.
public Task<List<Quote>> GetQuotesAsync(QuoteFilter filter)
// TODO: Implement optional, but possible filters for query.
public async Task<List<Quote>> GetQuotesAsync(QuoteFilter filter)
{
throw new NotImplementedException();
try
{
var query = _context.Quotes.AsQueryable();
return await query.ToListAsync();
}
catch (Exception e)
{
Console.WriteLine(e);
throw;
}
}
// TODO: Implement GetQuoteByIdAsync() method.