diff --git a/GanjooRazor/Areas/User/Pages/AddSong.cshtml.cs b/GanjooRazor/Areas/User/Pages/AddSong.cshtml.cs
index 63205c48..62d88192 100644
--- a/GanjooRazor/Areas/User/Pages/AddSong.cshtml.cs
+++ b/GanjooRazor/Areas/User/Pages/AddSong.cshtml.cs
@@ -6,11 +6,25 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Newtonsoft.Json;
using RMuseum.Models.Ganjoor.ViewModels;
+using RMuseum.Services;
namespace GanjooRazor.Areas.User.Pages
{
public class AddSongModel : PageModel
{
+ /// ganjoor service
+ ///
+ private readonly IGanjoorService _ganjoorService;
+
+ ///
+ /// constructor
+ ///
+ ///
+ public AddSongModel(IGanjoorService ganjoorService)
+ {
+ _ganjoorService = ganjoorService;
+ }
+
///
/// Last Error
///
@@ -57,6 +71,10 @@ namespace GanjooRazor.Areas.User.Pages
{
LastError = await putResponse.Content.ReadAsStringAsync();
}
+ else
+ {
+ await _ganjoorService.CacheCleanForPageById(PoemMusicTrackViewModel.PoemId);
+ }
}
else
{
diff --git a/GanjooRazor/Areas/User/Pages/ReviewSongs.cshtml.cs b/GanjooRazor/Areas/User/Pages/ReviewSongs.cshtml.cs
index 224dd39c..a10beb1e 100644
--- a/GanjooRazor/Areas/User/Pages/ReviewSongs.cshtml.cs
+++ b/GanjooRazor/Areas/User/Pages/ReviewSongs.cshtml.cs
@@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Newtonsoft.Json;
using RMuseum.Models.Ganjoor.ViewModels;
+using RMuseum.Services;
using RSecurityBackend.Models.Generic;
using System.Linq;
using System.Net.Http;
@@ -14,6 +15,19 @@ namespace GanjooRazor.Areas.User.Pages
{
public class ReviewSongsModel : PageModel
{
+ ///
+ /// ganjoor service
+ ///
+ private readonly IGanjoorService _ganjoorService;
+
+ ///
+ /// constructor
+ ///
+ ///
+ public ReviewSongsModel(IGanjoorService ganjoorService)
+ {
+ _ganjoorService = ganjoorService;
+ }
///
/// Last Error
///
@@ -130,6 +144,13 @@ namespace GanjooRazor.Areas.User.Pages
{
LastError = await putResponse.Content.ReadAsStringAsync();
}
+ else
+ {
+ if(PoemMusicTrackViewModel.Approved)
+ {
+ await _ganjoorService.CacheCleanForPageById(PoemMusicTrackViewModel.PoemId);
+ }
+ }
}
else
{
diff --git a/RMuseum/Services/Implementation/GanjoorService.cs b/RMuseum/Services/Implementation/GanjoorService.cs
index c3bec0cf..0258f094 100644
--- a/RMuseum/Services/Implementation/GanjoorService.cs
+++ b/RMuseum/Services/Implementation/GanjoorService.cs
@@ -1586,6 +1586,11 @@ namespace RMuseum.Services.Implementation
await _context.SaveChangesAsync();
+ if(track.Approved)
+ {
+ await CacheCleanForPageById(track.PoemId);
+ }
+
return new RServiceResult(song);
}
catch (Exception exp)
@@ -1665,6 +1670,8 @@ namespace RMuseum.Services.Implementation
_context.GanjoorPoemMusicTracks.Update(track);
await _context.SaveChangesAsync();
+ await CacheCleanForPageById(track.PoemId);
+
return new RServiceResult(song);
}
catch (Exception exp)