Exemplo n.º 1
0
        public ActionResult ConfirmEditProfile(int?id, Gameprofile gameprofile)
        {
            var SQLModel = new Gameprofile_SQL();

            SQLModel.EditProfile(id, gameprofile);

            return(RedirectToAction("EditProfile", id));
        }
        /// <summary>
        /// retrive rules from the database
        /// </summary>
        /// <param name="id">url id(profile)</param>
        /// <param name="gameprofile">profile model</param>
        /// <returns>rules</returns>
        public string GetRules(int?id, Gameprofile gameprofile)
        {
            if (id != null)
            {
                new Rules_SQL().FindProfile(id, gameprofile);
            }

            return(gameprofile.Rules);
        }
        /// <summary>
        /// gets the data for the poker chips
        /// </summary>
        /// <param name="id">url id(profile)</param>
        /// <param name="gameprofile">gameprofile data</param>
        /// <returns></returns>
        public ActionResult GetChipsData(int?id, Gameprofile gameprofile)
        {
            if (id != null)
            {
                new Gameprofile_SQL().FindProfile(id, gameprofile);
            }

            return(PartialView("PartialChipsData", JsonConvert.DeserializeObject <Chips>(gameprofile.Chips)));
        }
        public ActionResult EditRule(int?id, Gameprofile gameprofile)
        {
            if (id != null)
            {
                var SQLModel = new Rules_SQL();
                SQLModel.EditRules(id, gameprofile);
            }

            return(View("Index"));
        }
        /// <summary>
        /// initial page load
        /// </summary>
        /// <param name="id">url id(profile)</param>
        /// <param name="gameprofile">profile model</param>
        /// <returns>index page</returns>
        public ActionResult Index(int?id, Gameprofile gameprofile)
        {
            if (id != null)
            {
                new Rules_SQL().FindProfile(id, gameprofile);
                return(View(gameprofile));
            }

            return(View());
        }
        /// <summary>
        /// returns the chips edit page with the data to edit the selected item
        /// </summary>
        /// <param name="id">url id(profile)</param>
        /// <param name="gameprofile">gameprofile data</param>
        /// <returns></returns>
        public ActionResult Edit(int?id, Gameprofile gameprofile)
        {
            if (id == null)
            {
                return(View("Index"));
            }
            new Gameprofile_SQL().FindProfile(id, gameprofile);

            return(View(JsonConvert.DeserializeObject <Chips>(gameprofile.Chips)));
        }
        /// <summary>
        /// gets the edit page
        /// </summary>
        /// <param name="id">url id(profile)</param>
        /// <param name="gameprofile">profile model</param>
        /// <returns>edit page with profile data</returns>
        public ActionResult Edit(int?id, Gameprofile gameprofile)
        {
            if (id != null)
            {
                new Rules_SQL().FindProfile(id, gameprofile);
            }

            else
            {
                return(View("Index"));
            }

            return(View("Edit", gameprofile));
        }
Exemplo n.º 8
0
        /// <summary>
        /// loads edit profile page with the selected profile data
        /// </summary>
        /// <param name="id">url id(profile)</param>
        /// <param name="gameprofile">profile model</param>
        /// <returns>edit page with the selected profile data</returns>
        public ActionResult EditProfile(int?id, Gameprofile gameprofile)
        {
            if (id != null)
            {
                var SQLModel = new Gameprofile_SQL();
                SQLModel.FindProfile(id, gameprofile);
            }
            else
            {
                return(View("Index"));
            }

            AllModels allModels = new AllModels();

            allModels.Gameprofile = gameprofile;
            return(View(allModels));
        }
Exemplo n.º 9
0
        /// <summary>
        /// gets the selected profiles data
        /// </summary>
        /// <param name="id">url id(profile)</param>
        /// <param name="gameprofile">profile model</param>
        /// <returns>loads the partialview with the selected profile data</returns>
        public ActionResult GetProfileData(int?id, Gameprofile gameprofile)
        {
            if (id != null)
            {
                var SQLModel = new Gameprofile_SQL();
                SQLModel.FindProfile(id, gameprofile);
            }
            else
            {
                return(PartialView("PartialProfileData"));
            }

            AllModels allModels = new AllModels();

            allModels.Gameprofile = gameprofile;
            return(PartialView("PartialProfileData", allModels));
        }
Exemplo n.º 10
0
        public ActionResult CreateProfile(Gameprofile gameprofile, Round round)
        {
            if (ModelState.IsValid)
            {
                var Gameprofile_SQLModel = new Gameprofile_SQL();
                int AddedProfileID       = Gameprofile_SQLModel.CreateProfile(gameprofile);

                //Leave i = 1 !! needed for creating the correct round numbers
                for (int i = 1; i <= round.Number_Of_Rounds; i++)
                {
                    round.Round_NR = i;
                    round.Gameprofile_Profile_ID = AddedProfileID;
                    var Round_SQLModel = new Round_SQL();
                    Round_SQLModel.CreateRound(round);
                }
                return(RedirectToAction($"EditProfile/{AddedProfileID}"));
            }
            return(View("Index"));
        }