Exemplo n.º 1
0
        public async Task <AudioOwner> CreateAudioOwner(uint audioId, ulong ownerId, string name)
        {
            using var dbConnection = await dbConnectionFactory.CreateConnection();

            var cmdText    = "INSERT INTO audio_owner (audio, owner, name) VALUES (@audio, @owner, @name);";
            var parameters = new
            {
                audio = audioId,
                owner = ownerId,
                name
            };
            await dbConnection.ExecuteAsync(cmdText, parameters);

            var id = await dbConnection.ExecuteScalarAsync <uint>("SELECT LAST_INSERT_ID();");

            var result = new AudioOwner
            {
                AudioId = audioId,
                Id      = id,
                Name    = name,
                OwnerId = ownerId
            };

            return(result);
        }
Exemplo n.º 2
0
 public IViewComponentResult Invoke(AudioOwner audioOwner, List <Category> categories)
 {
     return(View(new Models.Components.Quote
     {
         AudioOwner = audioOwner,
         Categories = categories
     }));
 }