Commit ecc1a46a authored by Andres Käver's avatar Andres Käver

listitem endpoint filtering

parent ead4edd7
Pipeline #764 passed with stages
in 59 seconds
......@@ -24,13 +24,18 @@ namespace WebApp.Controllers
}
// GET: ListItems
public async Task<IActionResult> Index()
public async Task<IActionResult> Index(bool? completed)
{
var appDbContext = _context.ListItems
var query = _context.ListItems
.Include(l => l.ApiKey)
.Where(l => l.ApiKey!.AppUserId == User.GetLoggedInUserId());
return View(await appDbContext.ToListAsync());
.Where(l => l.ApiKey!.AppUserId == User.GetLoggedInUserId())
.AsQueryable();
if (completed != null)
{
query = query.Where(l => l.Completed == completed);
}
return View(await query.ToListAsync());
}
// GET: ListItems/Details/5
......
......@@ -17,7 +17,6 @@ namespace WebApp.Identity
var signingKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(key));
var signingCredentials = new SigningCredentials(signingKey, SecurityAlgorithms.HmacSha256);
var expires = DateTime.Now.AddDays(expiresInDays);
var token = new JwtSecurityToken(
issuer: issuer,
audience: issuer,
......@@ -25,8 +24,6 @@ namespace WebApp.Identity
expires: expires,
signingCredentials: signingCredentials
);
return new JwtSecurityTokenHandler().WriteToken(token);
}
......
......@@ -8,9 +8,7 @@ using DAL.App.EF;
using Domain.Identity;
using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.UI;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.HttpsPolicy;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment