public ActionResult <IEnumerable <Keep> > GetUserKeeps() { var id = HttpContext.User.FindFirstValue("Id"); var user = _userRepo.GetUserById(id); if (user != null) { return(Ok(_keepRepo.GetKeepsByUser(id))); } return(BadRequest()); }
public ActionResult <IEnumerable <Keep> > GetKeepsByUser(string userId) { try { var uid = HttpContext.User.FindFirstValue("Id"); userId = uid; return(Ok(_repo.GetKeepsByUser(userId))); } catch (Exception e) { return(BadRequest(e)); } }
public ActionResult <IEnumerable <Keep> > GetByUser() { string userId = HttpContext.User.FindFirstValue("Id"); IEnumerable <Keep> userKeeps = _repo.GetKeepsByUser(userId); try { return(Ok(userKeeps)); } catch (Exception e) { return(BadRequest(e)); } }