Example #1
0
 public ActionResult <IEnumerable <Keep> > GetKeepsByUserId() //REVIEW Adding IEnumerable to ActionResult removed "an explicit conversion exists" error
 {
     try
     {
         string userId = HttpContext.User.FindFirstValue("Id"); //stackoverflow
         return(Ok(_repository.GetKeepsByUserId(userId)));
     }
     catch (Exception e)
     {
         return(BadRequest(e.Message));
     }
 }
Example #2
0
        public ActionResult <IEnumerable <Keep> > Get()
        {
            string userId = HttpContext.User.FindFirstValue("Id");

            try
            {
                return(Ok(_repo.GetKeepsByUserId(userId)));
            }
            catch (Exception e)
            {
                return(BadRequest(e.Message));
            }
        }