Exemple #1
0
        public ActionResult EditCombos(string id, AddEditCombosViewModel vModel)
        {
            ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId());

            IFightingArtCombination obj = authedUser.GameAccount.Config.Combos.FirstOrDefault(combo => combo.Name.Equals(id));
            string message;

            if (obj == null)
            {
                message = "That does not exist";
                return(RedirectToAction("Combos", new { Message = message }));
            }

            obj.Name             = vModel.DataObject.Name;
            obj.Arts             = vModel.DataObject.Arts;
            obj.FightingStances  = vModel.DataObject.FightingStances;
            obj.IsSystem         = vModel.DataObject.IsSystem;
            obj.SituationalUsage = vModel.DataObject.SituationalUsage;

            if (authedUser.GameAccount.Config.Save(authedUser.GameAccount, authedUser.GetStaffRank(User)))
            {
                LoggingUtility.LogAdminCommandUsage("*WEB* - EditCombos[" + obj.Name.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle);
                message = "Edit Successful.";
            }
            else
            {
                message = "Error; Edit failed.";
            }

            return(RedirectToAction("Combos", new { Message = message }));
        }
Exemple #2
0
        public ActionResult AddCombos(AddEditCombosViewModel vModel)
        {
            ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId());

            var combos = authedUser.GameAccount.Config.Combos.ToList();

            if (combos.Any(combo => combo.Name.Equals(vModel.DataObject.Name)))
            {
                return(RedirectToAction("Combos", new { Message = "Name already taken choose another." }));
            }

            combos.Add(vModel.DataObject);

            authedUser.GameAccount.Config.Combos = combos;

            string message;

            if (authedUser.GameAccount.Config.Save(authedUser.GameAccount, authedUser.GetStaffRank(User)))
            {
                LoggingUtility.LogAdminCommandUsage("*WEB* - AddCombos[" + vModel.DataObject.Name.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle);
                message = "Creation Successful.";
            }
            else
            {
                message = "Error; Creation failed.";
            }

            return(RedirectToAction("Combos", new { Message = message }));
        }
Exemple #3
0
        public ActionResult AddCombos()
        {
            AddEditCombosViewModel vModel = new AddEditCombosViewModel
            {
                AuthedUser = UserManager.FindById(User.Identity.GetUserId()),
                DataObject = new FightingArtCombination()
            };

            return(View("AddCombos", vModel));
        }
Exemple #4
0
        public ActionResult EditCombos(string id)
        {
            AddEditCombosViewModel vModel = new AddEditCombosViewModel
            {
                AuthedUser = UserManager.FindById(User.Identity.GetUserId())
            };

            IFightingArtCombination obj = vModel.AuthedUser.GameAccount.Config.Combos.FirstOrDefault(combo => combo.Name.Equals(id));

            if (obj == null)
            {
                string message = "That does not exist";
                return(RedirectToAction("Combos", new { Message = message }));
            }

            vModel.DataObject = obj;

            return(View("EditCombos", vModel));
        }