コード例 #1
0
        public async Task <CharacterStatDefaultValue> UpdateCharacterStatDefaultValue(CharacterStatDefaultValue characterStatDefaultValue)
        {
            var DefaultValue = _context.CharacterStatDefaultValues.Find(characterStatDefaultValue.CharacterStatDefaultValueId);

            if (DefaultValue == null)
            {
                return(characterStatDefaultValue);
            }

            DefaultValue.Maximum = characterStatDefaultValue.Maximum;
            DefaultValue.Minimum = characterStatDefaultValue.Minimum;

            if (characterStatDefaultValue.Type == 1 || characterStatDefaultValue.Type == 2 || characterStatDefaultValue.Type == 8)
            {
                DefaultValue.Maximum = 0;
                DefaultValue.Minimum = 0;
            }
            DefaultValue.DefaultValue = characterStatDefaultValue.DefaultValue;
            DefaultValue.Type         = characterStatDefaultValue.Type;

            //var characterstatslist = _context.CharactersCharacterStats.Where(x => x.IsDeleted == false && x.CharacterStatId == characterStatDefaultValue.CharacterStatId).ToList();
            //foreach (var item in characterstatslist)
            //{
            //    item.Maximum = (int)characterStatDefaultValue.Maximum;
            //    item.Minimum = (int)characterStatDefaultValue.Minimum;
            //    item.DefaultValue = characterStatDefaultValue.DefaultValue;
            //}
            try
            {
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }
            return(DefaultValue);
        }
コード例 #2
0
 public async Task <CharacterStatDefaultValue> InsertCharacterStatDefaultValue(CharacterStatDefaultValue characterStatDefaultValue)
 {
     return(await _repo.Add(characterStatDefaultValue));
 }