public async Task <IActionResult> Get(Guid id) { try { return(new JsonResult(await _clubsService.GetClub(id))); } catch (UnauthorizedException) { return(new UnauthorizedResult()); } }
public IActionResult GetClubInfo(int id) { try { var email = User.Claims.SingleOrDefault(c => c.Type == "email")?.Value; if (string.IsNullOrEmpty(email)) { return(BadRequest("Authorization failed.")); } return(Ok(_service.GetClub(id, email))); } catch (Exception e) { return(BadRequest(e.Message)); } }