Пример #1
0
        public BoxerSummary(Boxer boxer, string boxerUrl)
        {
            BoxerNameLink = boxer.NameLink;
            BoxerName = boxer.FullName();
            BoxerNameReverse = boxer.FullNameReverse;
            Nationality = boxer.Nationality != null ? boxer.Nationality.Name : "N/A";
            Weight = boxer.Weight.Name;
            Boxrec = boxer.Boxrec;
            Age = boxer.DateOfBirth != null ? boxer.GetAge().ToString() : "N/A";
            BoxerUrl = boxerUrl.ToLowerInvariant();
            Credentials = boxer.Credentials;
            BoxerId = boxer.Id;
            Rankingpts = boxer.RankingPts;

            InternalLink = boxer.FirstName.Replace(" ", "_") + "/" + boxer.LastName.Replace(" ", "_");

            Match NextMatch = boxer.NextMatch();
            if (NextMatch != null)
            {
                NextMatchDate = NextMatch.MatchDate.Value;
                NextMatchString = NextMatch.MatchString(boxer.Id);
            }

            Match LastMatch = boxer.LastMatch();
            if (LastMatch != null)
            {
                LastMatchDate = LastMatch.MatchDate.Value;
                LastMatchString = LastMatch.MatchResultString(boxer.Id);

                if(LastMatch.Result.Winner == boxer){
                    LastMatchResult = "Won";
                }else if(LastMatch.Result.Winner != null){
                    LastMatchResult = "Lost";
                }else{
                    LastMatchResult = "Draw";
                }

            }

            if (boxer.Record != null)
            {
                Record = boxer.Record.Won + "-" + boxer.Record.Lost;
                if (boxer.Record.Drawn > 0)
                {
                    Record += "-" + boxer.Record.Drawn;
                }
                Record += " (" + boxer.Record.KO + ")";
            }

            //Only here as getting only prospects fails remove after its works
            IsProspect = boxer.IsProspect.ToString();
        }
Пример #2
0
        public ActionResult CreateAndSelectBoxer(Boxer NewBoxer)
        {
            //set boxers rankings
            NewBoxer.RankingPts = 0;

            //need to get weight id from page!!!
            NewBoxer.Weight = GetRepository<Weight>().Get(120);

            DataSession.Save(NewBoxer);

            return new JsonResult { Data = new { BoxerId = NewBoxer.Id, BoxerName = NewBoxer.FullName() } };
        }