public ActionResult <IEnumerable <Keep> > GetByUser() { try { string userId = HttpContext.User.FindFirstValue("Id"); return(Ok(_ks.GetByUser(userId))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <IEnumerable <Keep> > GetByUser() { try { var userId = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier).Value; return(Ok(_ks.GetByUser(userId))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public async Task <ActionResult <IEnumerable <Keep> > > GetByUser(string userid) { try { Profile userInfo = await HttpContext.GetUserInfoAsync <Profile>(); return(Ok(_serv.GetByUser(userid, userInfo))); } catch (Exception e) { return(BadRequest(e.Message)); } }
public ActionResult <IEnumerable <Keep> > GetByUser() { try { Claim user = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier); if (user == null) { throw new Exception("Must be logged in update a keep"); } return(Ok(_ks.GetByUser(user.Value))); } catch (Exception e) { return(BadRequest(e.Message)); }; }
public ActionResult <IEnumerable <Keep> > GetByUser(string userId) { try { Claim user = HttpContext.User.FindFirst(ClaimTypes.NameIdentifier); if (user == null) { throw new Exception("Please log in."); } userId = user.Value; return(Ok(_ks.GetByUser(userId))); } catch (Exception e) { return(BadRequest(e.Message)); }; }