public IActionResult Details(int id) { string userId = null; if (_signInManager.IsSignedIn(User)) { userId = User.FindFirst(ClaimTypes.NameIdentifier).Value; } var idea = _ideasHelper.GetIdea(id, userId); return(View(idea)); }
public IActionResult GetIdea(int id, [FromQuery] string userId) { try { return(Ok(_ideasHelper.GetIdea(id, userId))); } catch (ArgumentException e) { return(NotFound(e.Message)); } catch (Exception e) { return(BadRequest($"Something went wrong in getting the idea: {e.Message}.")); } }