public ActionResult Wackiest(int id) { PlayerEventCountryScore pecs = db.GetPlayerScoreByID(id); //get current user Guid playerID = pecs.PlayerGuid; //get any fattest scores==true var Wackos = db.GetPlayerScoresForYear(pecs.EventCountry.Event.Year, playerID).Where(x => x.Wackiest == true); if (Wackos.Count() > 0) { return(Json(new { success = true, matches = Wackos.Select(x => x.EventCountry.Country.Name) }, JsonRequestBehavior.AllowGet)); } else { return(Json(new { success = false }, JsonRequestBehavior.AllowGet)); } }
public ActionResult Score(int id) { PlayerEventCountryScore model = db.GetPlayerScoreByID(id); Guid currentplayer = (Guid)Membership.GetUser().ProviderUserKey; if (currentplayer != model.PlayerGuid) { throw new Exception("You are not the correct player for this record"); } return(View(model)); }