コード例 #1
0
        //UPDATE
        // TODO : ADD ADMIN RIGHTS ONLY
        public void Update(Character newVersion)
        {
            logger.Log("Inside character repository.Update.");

            var monPerso = Get(newVersion.CharacterName);

            if (monPerso == null)
            {
                return;
            }

            if (monPerso.GameName != newVersion.GameName)
            {
                return;
            }

            SheetFiller sFiller = new SheetFiller();
            // This might be reworked
            string mypath = ConfigurationManager.AppSettings["path"];
            string path   = System.Web.HttpContext.Current.Server.MapPath(mypath);

            // Save existing version in "backup" sub-folder
            sFiller.backUpCharacter(monPerso, path);

            try
            {
                UpdateSkills(monPerso, newVersion);
                UpdateStats(monPerso, newVersion);
                UpdateBaseAttr(monPerso, newVersion);
                UpdateSpendPoints(monPerso, newVersion);
            }
            catch (Exception ex)
            {
                logger.Log(String.Format("Error in Repo.update character : {0}", ex.Message));
                throw ex;
            }
        }