Example #1
0
        public ActionResult EditCharacter(long id, AddEditCharacterViewModel vModel)
        {
            string          userId     = User.Identity.GetUserId();
            ApplicationUser authedUser = UserManager.FindById(userId);
            IPlayerTemplate obj        = PlayerDataCache.Get(new PlayerDataCacheKey(typeof(IPlayerTemplate), authedUser.GlobalIdentityHandle, id));

            obj.Name                = vModel.DataObject.Name;
            obj.SurName             = vModel.DataObject.SurName;
            obj.Gender              = vModel.DataObject.Gender;
            obj.SuperSenses         = vModel.DataObject.SuperSenses;
            obj.GamePermissionsRank = vModel.DataObject.GamePermissionsRank;
            obj.Race                = vModel.DataObject.Race;
            string message;

            if (obj == null)
            {
                message = "That character does not exist";
            }
            else
            {
                if (obj.Save(authedUser.GameAccount, authedUser.GetStaffRank(User)))
                {
                    LoggingUtility.Log("*WEB* - EditCharacter[" + authedUser.GameAccount.GlobalIdentityHandle + "]", LogChannels.AccountActivity);
                    message = "Edit Successful.";
                }
                else
                {
                    message = "Error; edit failed.";
                }
            }

            return(RedirectToAction("ManageCharacters", new { Message = message }));
        }
Example #2
0
        public ActionResult EditCharacter(long id)
        {
            string          userId = User.Identity.GetUserId();
            ApplicationUser user   = UserManager.FindById(userId);

            IPlayerTemplate           obj   = PlayerDataCache.Get(new PlayerDataCacheKey(typeof(IPlayerTemplate), user.GlobalIdentityHandle, id));
            AddEditCharacterViewModel model = new AddEditCharacterViewModel
            {
                AuthedUser   = user,
                DataObject   = obj,
                ValidRaces   = TemplateCache.GetAll <IRace>(),
                ValidGenders = TemplateCache.GetAll <IGender>()
            };

            return(View(model));
        }
Example #3
0
 /// <summary>
 /// The backing data for this entity
 /// </summary>
 public override T Template <T>()
 {
     return((T)PlayerDataCache.Get(new PlayerDataCacheKey(typeof(IPlayerTemplate), AccountHandle, TemplateId)));
 }