added user not found page

This commit is contained in:
Nicolas Constant 2020-12-29 02:12:44 -05:00
parent 6b397d15d7
commit 47649392ed
No known key found for this signature in database
GPG key ID: 1E9F677FB01A5688
2 changed files with 22 additions and 1 deletions

View file

@ -36,21 +36,31 @@ namespace BirdsiteLive.Controllers
}
#endregion
[Route("/users")]
public IActionResult Index()
{
var r = Request.Headers["Accept"].First();
if (r.Contains("application/activity+json")) return NotFound();
return View("UserNotFound");
}
[Route("/@{id}")]
[Route("/users/{id}")]
public IActionResult Index(string id)
{
var user = _twitterService.GetUser(id);
if (user == null) return NotFound();
var r = Request.Headers["Accept"].First();
if (r.Contains("application/activity+json"))
{
if (user == null) return NotFound();
var apUser = _userService.GetUser(user);
var jsonApUser = JsonConvert.SerializeObject(apUser);
return Content(jsonApUser, "application/activity+json; charset=utf-8");
}
if (user == null) return View("UserNotFound");
var displayableUser = new DisplayTwitterUser
{
Name = user.Name,

View file

@ -0,0 +1,11 @@
@{
ViewData["Title"] = "User";
}
<div class="col-12 col-sm-10 col-md-8 col-lg-6 mx-auto text-center">
<h3>User not found</h3>
<a href="/" class="btn btn-primary">
Back
</a>
</div>