コード例 #1
0
ファイル: KeepsController.cs プロジェクト: austinhugus/Keepr
 public ActionResult <IEnumerable <Keep> > GetKeepsByUser()
 {
     try {
         string userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
         return(Ok(_ks.GetByUserId(userId)));
     } catch (Exception e) {
         return(BadRequest(e.Message));
     };
 }
コード例 #2
0
 public ActionResult <IEnumerable <Keep> > GetKeepsByUser()
 {
     try
     {
         string userId = findUserInfo();
         return(Ok(_ks.GetByUserId(userId)));
     }
     catch (System.Exception err)
     {
         return(BadRequest(err.Message));
     }
 }
コード例 #3
0
 public ActionResult <IEnumerable <Keep> > GetByUserId()
 {
     try
     {
         var userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
         return(Ok(_ks.GetByUserId(userId)));
     }
     catch (System.Exception err)
     {
         return(BadRequest(err.Message));
     }
 }
コード例 #4
0
 public ActionResult <IEnumerable <Keep> > GetByUserId(int id)
 {
     try
     {
         string userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value;
         if (userId == null)
         {
             throw new Exception("you need to be loged in to get keeps by userid");
         }
         return(Ok(_ks.GetByUserId(userId)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     };
 }
コード例 #5
0
ファイル: KeepsController.cs プロジェクト: davidwfolk/keepr
 public ActionResult <IEnumerable <Keep> > GetKeepsByUser()
 {
     try
     {
         Claim user = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier);
         if (user == null)
         {
             throw new Exception("You must be logged in to get your keeps!");
         }
         string userId = user.Value;
         return(Ok(_ks.GetByUserId(userId)));
     }
     catch (System.Exception err)
     {
         return(BadRequest(err.Message));
     }
 }