예제 #1
0
        public async Task <DatabaseModel.Level> Add(DatabaseModel.Level level)
        {
            var query = _levelQueries.CreteNewLevel(level);
            var res   = await _databaseConnection.ExecuteScalarAsync(query);

            var insertId = (int)res;

            return(new DatabaseModel.Level(level.Name, level.Chat, level.Ticket, level.Admin, insertId));
        }
예제 #2
0
 public SqlQuery CreteNewLevel(DatabaseModel.Level level)
 {
     return(new SqlQuery("INSERT INTO Level (Name, Chat, Ticket, Admin) OUTPUT INSERTED.Id VALUES (@name,@chat,@ticket,@admin);",
                         new Dictionary <string, object>
     {
         { "@name", level.Name },
         { "@chat", level.Chat },
         { "@ticket", level.Ticket },
         { "@admin", level.Admin }
     }));
 }
예제 #3
0
 public async Task <dynamic> AddLevel([FromBody] DatabaseModel.Level level)
 {
     return(await _levelService.Add(level));
 }
예제 #4
0
 public async Task <DatabaseModel.Level> Add(DatabaseModel.Level level)
 {
     return(await _repoServiceFactory.LevelRepoService.Add(level));
 }