Using declarations and other code reformats

This commit is contained in:
Kwoth
2021-12-26 03:22:45 +01:00
parent d18f9429c6
commit b85ba177cd
64 changed files with 2349 additions and 2736 deletions

View File

@@ -42,10 +42,8 @@ public class RadioResolver : IRadioResolver
string file = null;
try
{
using (var http = new HttpClient())
{
file = await http.GetStringAsync(query).ConfigureAwait(false);
}
using var http = new HttpClient();
file = await http.GetStringAsync(query).ConfigureAwait(false);
}
catch
{

View File

@@ -64,18 +64,16 @@ public sealed partial class Music
var success = false;
try
{
await using (var uow = _db.GetDbContext())
{
var pl = uow.MusicPlaylists.FirstOrDefault(x => x.Id == id);
await using var uow = _db.GetDbContext();
var pl = uow.MusicPlaylists.FirstOrDefault(x => x.Id == id);
if (pl != null)
if (pl != null)
{
if (_creds.IsOwner(ctx.User) || pl.AuthorId == ctx.User.Id)
{
if (_creds.IsOwner(ctx.User) || pl.AuthorId == ctx.User.Id)
{
uow.MusicPlaylists.Remove(pl);
await uow.SaveChangesAsync();
success = true;
}
uow.MusicPlaylists.Remove(pl);
await uow.SaveChangesAsync();
success = true;
}
}
}