diff --git a/CouchLog/Components/Pages/GlobalList/Dialogs/AddNewGlobalEntityDialog.razor b/CouchLog/Components/Pages/GlobalList/Dialogs/AddNewGlobalEntityDialog.razor index dd02e4c..57feb7f 100644 --- a/CouchLog/Components/Pages/GlobalList/Dialogs/AddNewGlobalEntityDialog.razor +++ b/CouchLog/Components/Pages/GlobalList/Dialogs/AddNewGlobalEntityDialog.razor @@ -120,6 +120,9 @@ //Picture private IBrowserFile? _pictureFile; + private string _pictureBase64; + private string? _pictureContentType; + private string? _pictureExtension; private class GlobalEntityFormModel { @@ -164,9 +167,12 @@ await using var stream = _pictureFile.OpenReadStream(5242880); using var ms = new MemoryStream(); await stream.CopyToAsync(ms); + + _pictureContentType = _pictureFile.ContentType; + _pictureExtension = Path.GetExtension(_pictureFile.Name); - var base64 = Convert.ToBase64String(ms.ToArray()); - _imagePreview = $"data:{_pictureFile.ContentType};base64,{base64}"; + _pictureBase64 = Convert.ToBase64String(ms.ToArray()); + _imagePreview = $"data:{_pictureFile.ContentType};base64,{_pictureBase64}"; } private void Cancel() => MudDialog.Cancel(); @@ -191,13 +197,10 @@ try { - string fileName = $"{Guid.NewGuid()}{Path.GetExtension(_pictureFile.Name)}"; + string fileName = $"{Guid.NewGuid()}{_pictureExtension}"; string picturePath = Path.Combine("wwwroot", "Pictures", fileName); - - await using (var fs = File.Create(picturePath)) - { - await _pictureFile.OpenReadStream(maxAllowedSize: 10_000_000).CopyToAsync(fs); - } + + await File.WriteAllBytesAsync(picturePath, Convert.FromBase64String(_pictureBase64)); var entity = new GlobalEntity { diff --git a/CouchLog/Components/Pages/GlobalList/GlobalList.razor b/CouchLog/Components/Pages/GlobalList/GlobalList.razor index 58db7e7..c1d54d4 100644 --- a/CouchLog/Components/Pages/GlobalList/GlobalList.razor +++ b/CouchLog/Components/Pages/GlobalList/GlobalList.razor @@ -151,7 +151,7 @@ private async Task OnNewEntity(GlobalEntity entity) { - _globalEntities.Add(entity); + _globalEntities.Insert(0, entity); await RefreshPage(); } diff --git a/CouchLog/Components/Pages/PrivateList/Components/PrivateEntityCard.razor b/CouchLog/Components/Pages/PrivateList/Components/PrivateEntityCard.razor index 901fc58..666d586 100644 --- a/CouchLog/Components/Pages/PrivateList/Components/PrivateEntityCard.razor +++ b/CouchLog/Components/Pages/PrivateList/Components/PrivateEntityCard.razor @@ -39,46 +39,49 @@ } + + @if (PrivateEntity.GlobalEntity.MediaType.Name == "Series" || PrivateEntity.GlobalEntity.MediaType.Name == "Anime") + { + + + @{ + int? currentSeason = PrivateEntity.Season ?? 1; + int? startOffsetSeason = currentSeason > 1 ? -1 : 0; + } + @for (int? i = startOffsetSeason; i <= 5; i++) + { + int? season = currentSeason + i; + Staffel @season + } + + - - - @{ - int? currentSeason = PrivateEntity.Season ?? 1; - int? startOffsetSeason = currentSeason > 1 ? -1 : 0; - } - @for (int? i = startOffsetSeason; i <= 5; i++) - { - int? season = currentSeason + i; - Staffel @season - } - - - - - - @{ - int? currentEpisode = PrivateEntity.Episode ?? 1; - int? startOffsetEpisode = currentEpisode > 1 ? -1 : 0; - } - @for (int? i = startOffsetEpisode; i <= 5; i++) - { - int? episode = currentEpisode + i; - Episode @episode - } - - + + + @{ + int? currentEpisode = PrivateEntity.Episode ?? 1; + int? startOffsetEpisode = currentEpisode > 1 ? -1 : 0; + } + @for (int? i = startOffsetEpisode; i <= 5; i++) + { + int? episode = currentEpisode + i; + Episode @episode + } + + + }