updated logic for query episodes by title. added ability to query quotes by narrator
This commit is contained in:
@@ -36,7 +36,7 @@ namespace server.Persistence.Repositories
|
|||||||
|
|
||||||
if (filter?.Title != null)
|
if (filter?.Title != null)
|
||||||
{
|
{
|
||||||
query = query.Where(episode => episode.Title!.ToLower() == filter.Title.ToLower());
|
query = query.Where(episode => episode.Title!.ToLower().Contains(filter.Title.ToLower()));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filter?.SummaryKeyword != null)
|
if (filter?.SummaryKeyword != null)
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using MongoDB.Driver;
|
using MongoDB.Driver;
|
||||||
|
using MongoDB.Driver.Linq;
|
||||||
using server.Models;
|
using server.Models;
|
||||||
|
|
||||||
namespace server.Persistence.Repositories
|
namespace server.Persistence.Repositories
|
||||||
@@ -18,6 +19,12 @@ namespace server.Persistence.Repositories
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
var query = _context.Quotes.AsQueryable();
|
var query = _context.Quotes.AsQueryable();
|
||||||
|
|
||||||
|
if (filter?.Narrator != null)
|
||||||
|
{
|
||||||
|
query = query.Where(quote => quote.Narrator!.ToLower().Contains(filter.Narrator.ToLower()));
|
||||||
|
}
|
||||||
|
|
||||||
return await query.ToListAsync();
|
return await query.ToListAsync();
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
|
|||||||
@@ -11,7 +11,6 @@
|
|||||||
"profiles": {
|
"profiles": {
|
||||||
"server": {
|
"server": {
|
||||||
"commandName": "Project",
|
"commandName": "Project",
|
||||||
"launchUrl": "swagger",
|
|
||||||
"environmentVariables": {
|
"environmentVariables": {
|
||||||
"ASPNETCORE_ENVIRONMENT": "Development"
|
"ASPNETCORE_ENVIRONMENT": "Development"
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user