implemented getting all quotes
This commit is contained in:
@@ -44,10 +44,10 @@ namespace server.Controllers.v1
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO
|
// TODO: Implement getquotesbyid
|
||||||
[MapToApiVersion("1.0")]
|
[MapToApiVersion("1.0")]
|
||||||
[HttpGet]
|
[HttpGet("{id:int}")]
|
||||||
public async Task<ActionResult<Quote>> GetQuoteByIdAsync(int id)
|
public Task<ActionResult<Quote>> GetQuoteByIdAsync(int id)
|
||||||
{
|
{
|
||||||
throw new NotImplementedException();
|
throw new NotImplementedException();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,5 @@
|
|||||||
using server.Models;
|
using MongoDB.Driver;
|
||||||
using System;
|
using server.Models;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Text;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
namespace server.Persistence.Repositories
|
namespace server.Persistence.Repositories
|
||||||
{
|
{
|
||||||
@@ -16,10 +12,19 @@ namespace server.Persistence.Repositories
|
|||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: Implement GetQuotesAsync() method.
|
// TODO: Implement optional, but possible filters for query.
|
||||||
public Task<List<Quote>> GetQuotesAsync(QuoteFilter filter)
|
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.
|
// TODO: Implement GetQuoteByIdAsync() method.
|
||||||
|
|||||||
Reference in New Issue
Block a user