updated logic for query episodes by title. added ability to query quotes by narrator

This commit is contained in:
StevanFreeborn
2022-06-23 15:43:39 -05:00
parent 0957b27863
commit 911c199ba2
3 changed files with 8 additions and 2 deletions
@@ -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)
-1
View File
@@ -11,7 +11,6 @@
"profiles": { "profiles": {
"server": { "server": {
"commandName": "Project", "commandName": "Project",
"launchUrl": "swagger",
"environmentVariables": { "environmentVariables": {
"ASPNETCORE_ENVIRONMENT": "Development" "ASPNETCORE_ENVIRONMENT": "Development"
}, },