示例#1
0
        public static AttributeInCharacter Get(int?id)
        {
            AttributeInCharacter attributesInCharacter = new AttributeInCharacter();

            try
            {
                attributesInCharacter = ctx.AttributeInCharacters.Find(id);
            }
            catch (Exception e) { }

            return(attributesInCharacter);
        }
        public ActionResult AddAttributePointToAnCharacter(int characterId, int attributeInCharacterId)
        {
            Character character = CharacterDAO.Get(characterId);

            if (character.AttributePoints > 0)
            {
                AttributeInCharacter attributeInCharacter = AttributeInCharacterDAO.Get(attributeInCharacterId);

                attributeInCharacter.ProficiencyPoints++;
                character.AttributePoints--;

                CharacterDAO.Update(character);
                AttributeInCharacterDAO.Update(attributeInCharacter);
            }
            return(RedirectToAction("Index", "Home", null));
        }
示例#3
0
 public static void Update(AttributeInCharacter attributeInCharacter)
 {
     ctx.Entry(attributeInCharacter).State = System.Data.Entity.EntityState.Modified;
     ctx.SaveChanges();
 }