コード例 #1
0
        public async Task <BuffAndEffect> Update(BuffAndEffect item)
        {
            var buffAndEffect = _context.BuffAndEffects.FirstOrDefault(x => x.BuffAndEffectId == item.BuffAndEffectId);

            if (buffAndEffect == null)
            {
                return(buffAndEffect);
            }

            buffAndEffect.Name = item.Name;

            buffAndEffect.Command     = item.Command;
            buffAndEffect.CommandName = item.CommandName;
            buffAndEffect.Description = item.Description;
            buffAndEffect.gmOnly      = item.gmOnly;
            buffAndEffect.Stats       = item.Stats;
            buffAndEffect.ImageUrl    = item.ImageUrl;

            buffAndEffect.Metatags = item.Metatags;


            try
            {
                _context.SaveChanges();
            }
            catch (Exception ex)
            {
                throw ex;
            }

            return(buffAndEffect);
        }
コード例 #2
0
        public List <BuffAndEffect> GetByRuleSetId_add_Old(int rulesetId)
        {
            List <BuffAndEffect> buffAndEffectList = new List <BuffAndEffect>();
            string connectionString = _configuration.GetSection("ConnectionStrings").GetSection("DefaultConnection").Value;
            //string qry = "EXEC AbilitiesByRuleSetId_add @RulesetID = '" + rulesetId + "'";

            SqlConnection  connection = new SqlConnection(connectionString);
            SqlCommand     command    = new SqlCommand();
            SqlDataAdapter adapter    = new SqlDataAdapter();
            DataSet        ds         = new DataSet();

            try
            {
                connection.Open();
                command = new SqlCommand("BuffAndEffectsByRuleSetId_add", connection);

                // Add the parameters for the SelectCommand.
                command.Parameters.AddWithValue("@RulesetID", rulesetId);
                command.CommandType = CommandType.StoredProcedure;

                adapter.SelectCommand = command;

                adapter.Fill(ds);
                command.Dispose();
                connection.Close();
            }
            catch (Exception ex)
            {
                command.Dispose();
                connection.Close();
            }

            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    BuffAndEffect _buffAndEffect = new BuffAndEffect();
                    _buffAndEffect.Name            = row["Name"] == DBNull.Value ? null : row["Name"].ToString();
                    _buffAndEffect.ImageUrl        = row["ImageUrl"] == DBNull.Value ? null : row["ImageUrl"].ToString();
                    _buffAndEffect.BuffAndEffectId = row["BuffAndEffectId"] == DBNull.Value ? 0 : Convert.ToInt32(row["BuffAndEffectId"].ToString());
                    _buffAndEffect.RuleSetId       = row["RuleSetId"] == DBNull.Value ? 0 : Convert.ToInt32(row["RuleSetId"].ToString());

                    buffAndEffectList.Add(_buffAndEffect);
                }
            }
            return(buffAndEffectList);
        }
コード例 #3
0
 public async Task <BuffAndEffect> Core_CreateBuffAndEffect(BuffAndEffect buffAndEffects)
 {
     buffAndEffects.ParentBuffAndEffectId = buffAndEffects.BuffAndEffectId;
     buffAndEffects.BuffAndEffectId       = 0;
     return(await _repo.Add(buffAndEffects));
 }
コード例 #4
0
 public async Task <BuffAndEffect> Create(BuffAndEffect item)
 {
     return(await _repo.Add(item));
 }
コード例 #5
0
        public AbilityAssociatedRecords SP_GetAbilityCommands_Old(int abilityId, int RuleSetID)
        {
            AbilityAssociatedRecords result                  = new AbilityAssociatedRecords();
            List <AbilityCommand>    _abilityCommand         = new List <AbilityCommand>();
            List <BuffAndEffect>     _BuffAndEffects         = new List <BuffAndEffect>();
            List <BuffAndEffect>     _selectedBuffAndEffects = new List <BuffAndEffect>();
            string connectionString = _configuration.GetSection("ConnectionStrings").GetSection("DefaultConnection").Value;
            // string qry = "EXEC Ability_GetAbilityCommands @AbilityId = '" + abilityId + "'";
            SqlConnection  connection = new SqlConnection(connectionString);
            SqlCommand     command    = new SqlCommand();
            SqlDataAdapter adapter    = new SqlDataAdapter();
            DataSet        ds         = new DataSet();

            try
            {
                connection.Open();
                command = new SqlCommand("Ability_GetAbilityCommands", connection);

                // Add the parameters for the SelectCommand.
                command.Parameters.AddWithValue("@AbilityId", abilityId);
                command.Parameters.AddWithValue("@RulesetID", RuleSetID);
                command.CommandType = CommandType.StoredProcedure;

                adapter.SelectCommand = command;

                adapter.Fill(ds);
                command.Dispose();
                connection.Close();
            }
            catch (Exception ex)
            {
                command.Dispose();
                connection.Close();
            }
            if (ds.Tables[0].Rows.Count > 0)
            {
                foreach (DataRow row in ds.Tables[0].Rows)
                {
                    AbilityCommand _cmd = new AbilityCommand();

                    _cmd.Command          = row["Command"] == DBNull.Value ? null : row["Command"].ToString();
                    _cmd.AbilityId        = row["AbilityId"] == DBNull.Value ? 0 : Convert.ToInt32(row["AbilityId"].ToString());
                    _cmd.AbilityCommandId = row["AbilityCommandId"] == DBNull.Value ? 0 : Convert.ToInt32(row["AbilityCommandId"].ToString());
                    _cmd.IsDeleted        = row["IsDeleted"] == DBNull.Value ? false : Convert.ToBoolean(row["IsDeleted"]);
                    _cmd.Name             = row["Name"] == DBNull.Value ? null : row["Name"].ToString();

                    _abilityCommand.Add(_cmd);
                }
            }
            if (ds.Tables[1].Rows.Count > 0)
            {
                foreach (DataRow row in ds.Tables[1].Rows)
                {
                    BuffAndEffect i = new BuffAndEffect();
                    i.BuffAndEffectId = row["BuffAndEffectId"] == DBNull.Value ? 0 : Convert.ToInt32(row["BuffAndEffectId"]);
                    i.RuleSetId       = row["RuleSetId"] == DBNull.Value ? 0 : Convert.ToInt32(row["RuleSetId"]);
                    i.Name            = row["Name"] == DBNull.Value ? null : row["Name"].ToString();
                    i.ImageUrl        = row["ImageUrl"] == DBNull.Value ? null : row["ImageUrl"].ToString();

                    _BuffAndEffects.Add(i);/////////
                }
            }
            if (ds.Tables[2].Rows.Count > 0)
            {
                foreach (DataRow row in ds.Tables[2].Rows)
                {
                    BuffAndEffect i = new BuffAndEffect();
                    i.BuffAndEffectId = row["BuffAndEffectId"] == DBNull.Value ? 0 : Convert.ToInt32(row["BuffAndEffectId"]);
                    i.RuleSetId       = row["RuleSetId"] == DBNull.Value ? 0 : Convert.ToInt32(row["RuleSetId"]);
                    i.Name            = row["Name"] == DBNull.Value ? null : row["Name"].ToString();
                    i.ImageUrl        = row["ImageUrl"] == DBNull.Value ? null : row["ImageUrl"].ToString();

                    _selectedBuffAndEffects.Add(i);///////
                }
            }

            result.AbilityCommands        = _abilityCommand;
            result.BuffAndEffectsList     = _BuffAndEffects;
            result.SelectedBuffAndEffects = _selectedBuffAndEffects;
            return(result);
            // return _abilityCommand;
        }