Exemplo n.º 1
0
        public ActionResult AddFeatures()
        {
            var teamNameBl = new TeamDetailsBL();
            var model      = new TeamFeaturesModel();
            //  var playDetails = new PlayDetailsBL();

            var teamDetails = teamNameBl.GetSingle();

            if (teamDetails != null)
            {
                model.Season        = teamDetails.SeasonYear;
                model.HomeTeam      = teamDetails.TeamName;
                model.TeamId        = teamDetails.Id;
                model.Date          = DateTime.Now;
                Session["HomeTeam"] = model.HomeTeam;
                Session["Season"]   = model.Season;
            }
            model.successMessage = (TempData["SuccessMessage"] ?? String.Empty).ToString();
            model.errorMessage   = (TempData["ErrorMessage"] ?? String.Empty).ToString();
            if (!String.IsNullOrEmpty(model.successMessage))
            {
                model.isSuccessMessage = true;
            }
            if (!String.IsNullOrEmpty(model.errorMessage))
            {
                model.isSuccessMessage = true;
            }
            return(View(model));
        }
Exemplo n.º 2
0
        //public JsonResult GetPersonInformations()
        //{
        //    var listOfPlayers = new PlayerDetailsBL();
        //    var playerDetailsList = new List<PlayerDetailsList>();

        //    var playerDetails = listOfPlayers.GetALL();

        //    foreach (var player in playerDetails)
        //    {
        //        playerDetailsList.Add
        //        (
        //             new PlayerDetailsList
        //             {
        //                 Id = player.id,
        //                 DateOfBirth = player.DateOfBirth,
        //                 FirstName = player.FirstName,
        //                 LastName = player.LastName,
        //                 Weight = player.Weight,
        //                 Height = player.Height,
        //                 Notes = player.Notes

        //             });
        //    }
        //    return Json(playerDetailsList, JsonRequestBehavior.AllowGet);
        //}
        #endregion
        public JsonResult GetFeaturesAndScores()
        {
            var playDetails = new PlayDetailsBL();
            var model       = new List <TeamFeaturesModel>();
            var teamDetails = new TeamDetailsBL();

            var result = playDetails.GetALL();

            foreach (var detail in result)
            {
                model.Add
                (
                    new TeamFeaturesModel
                {
                    HomeTeam       = teamDetails.GetByID((int)detail.TeamId).TeamName, // Session["HomeTeam"].ToString(),
                    PlayingAgainst = detail.TeamAgainst,
                    Season         = teamDetails.GetByID((int)detail.TeamId).SeasonYear,
                    Venue          = (detail.Venue ?? "").ToString(),
                    id             = detail.Id,
                    AwayTeamScore  = (detail.AwayScore ?? "").ToString(),
                    Date           = (System.DateTime)detail.FixtureDate,
                    HomeScore      = (detail.HomeScore ?? "").ToString()
                });
            }
            return(Json(model, JsonRequestBehavior.AllowGet));
        }
Exemplo n.º 3
0
        public ActionResult AddTeam(TeamModel model)
        {
            if (ModelState.IsValid)
            {
                var addUseraddANewTeam      = new TeamDetailsBL();
                var addUseraddANewTeamModel = new TeamManagement.BO.Team
                {
                    Motto      = model.Motto,
                    SeasonYear = model.SeasonYear,
                    SportCode  = model.SportCode,
                    TeamName   = model.TeamName
                };
                string message = addUseraddANewTeam.Insert(addUseraddANewTeamModel);

                if (message.Equals(String.Empty))
                {
                    model.successMessage = true;
                    model.errorMessage   = "Team Successfully added";
                    return(View(model));
                }
                else
                {
                    model.successMessage = false;
                    model.errorMessage   = message;
                    return(View(model));
                }
            }

            return(View());
        }