Mark read and unread

This commit is contained in:
rockstardev
2020-05-28 22:57:18 -05:00
parent 654bb0c8ca
commit 359e761922
3 changed files with 32 additions and 4 deletions

View File

@@ -74,5 +74,20 @@ namespace BTCPayServer.Controllers
return RedirectToAction(nameof(Index));
}
[HttpGet]
public async Task<IActionResult> FlipRead(string id)
{
// TODO: Refactor
var claimWithId = User.Claims.SingleOrDefault(a => a.Type == ClaimTypes.NameIdentifier);
if (claimWithId == null)
return RedirectToAction("Index", "Home");
var notif = _db.Notifications.SingleOrDefault(a => a.Id == id && a.ApplicationUserId == claimWithId.Value);
notif.Seen = !notif.Seen;
await _db.SaveChangesAsync();
return RedirectToAction(nameof(Index));
}
}
}