Example #1
0
 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));
     };
 }
Example #2
0
 public ActionResult <IEnumerable <Keep> > GetKeepsByUser()
 {
     try
     {
         string userId = findUserInfo();
         return(Ok(_ks.GetByUserId(userId)));
     }
     catch (System.Exception err)
     {
         return(BadRequest(err.Message));
     }
 }
Example #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));
     }
 }
Example #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));
     };
 }
Example #5
0
 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));
     }
 }