コード例 #1
0
ファイル: ClubsController.cs プロジェクト: NTZemp/Lama.Api
 public async Task <IActionResult> Get(Guid id)
 {
     try
     {
         return(new JsonResult(await _clubsService.GetClub(id)));
     }
     catch (UnauthorizedException)
     {
         return(new UnauthorizedResult());
     }
 }
コード例 #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));
     }
 }