Пример #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));
 }