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)); }
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 } })); }
public async Task <dynamic> AddLevel([FromBody] DatabaseModel.Level level) { return(await _levelService.Add(level)); }
public async Task <DatabaseModel.Level> Add(DatabaseModel.Level level) { return(await _repoServiceFactory.LevelRepoService.Add(level)); }