Ejemplo n.º 1
0
 public async Task <IActionResult> Get(Guid id)
 {
     try
     {
         return(new JsonResult(await _clubsService.GetClub(id)));
     }
     catch (UnauthorizedException)
     {
         return(new UnauthorizedResult());
     }
 }
Ejemplo n.º 2
0
 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));
     }
 }