added user not found page
This commit is contained in:
parent
6b397d15d7
commit
47649392ed
2 changed files with 22 additions and 1 deletions
|
@ -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,
|
||||
|
|
11
src/BirdsiteLive/Views/Users/UserNotFound.cshtml
Normal file
11
src/BirdsiteLive/Views/Users/UserNotFound.cshtml
Normal 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>
|
Reference in a new issue