public async Task <string> GetLeaguesForUser() { // Obtain UserID. var userID = Int32.Parse(HttpContext.User.FindFirst(ClaimTypes.Name).Value); // Returns a list of League Objects. var leagues = await _leagueService.GetLeaguesForUser(userID); return(Newtonsoft.Json.JsonConvert.SerializeObject(leagues)); }
public JsonResult GetLeaguesForUser(int UserID) { return(Json(LeagueService.GetLeaguesForUser(UserID), JsonRequestBehavior.AllowGet)); }