예제 #1
0
        public async Task <CharacterStatCombo> UpdateCharacterStatCombo(CharacterStatCombo characterStatCombo)
        {
            var combo = _context.CharacterStatCombos.Find(characterStatCombo.CharacterStatComboId);

            if (combo == null)
            {
                return(characterStatCombo);
            }

            combo.Maximum      = characterStatCombo.Maximum;
            combo.Minimum      = characterStatCombo.Minimum;
            combo.DefaultValue = characterStatCombo.DefaultValue;
            combo.DefaultText  = characterStatCombo.DefaultText;

            var characterstatslist = _context.CharactersCharacterStats.Where(x => x.IsDeleted == false && x.CharacterStatId == characterStatCombo.CharacterStatId).ToList();

            foreach (var item in characterstatslist)
            {
                item.Maximum      = characterStatCombo.Maximum == null?0: (int)characterStatCombo.Maximum;
                item.Minimum      = characterStatCombo.Minimum == null ? 0 : (int)characterStatCombo.Minimum;
                item.DefaultValue = characterStatCombo.DefaultValue;
                item.ComboText    = characterStatCombo.DefaultText;
            }
            try
            {
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(combo);
        }
예제 #2
0
 public async Task <CharacterStatCombo> InsertCharacterStatCombo(CharacterStatCombo characterStatCombo)
 {
     return(await _repo.Add(characterStatCombo));
 }