#185 preventing bp suggestion tool to work under read only mode

This commit is contained in:
Hamid Reza Mohammadi 2021-07-24 20:51:05 +04:30
parent 7d110bdfdc
commit 6d0395998d
2 changed files with 32 additions and 2 deletions

View File

@ -36,6 +36,17 @@
<body>
<div id="fa">
<div class="poem">
@if (Model.ReadOnlyMode)
{
<div class="width-100per">
<div class="width-100per text-align-center">
<p class="alert-text">
امکان پیشنهاد قطعه موقتا به دلیل تغییرات سایت و یا انتقال سرور وجود ندارد. لطفاً ساعاتی دیگر مجدداً تلاش کنید.
</p>
</div>
</div>
}
else
@if (Model.PoemId == 0)
{
<div class="width-100per">
@ -47,7 +58,7 @@
</div>
}
else
if (!Model.LoggedIn)
if (!Model.LoggedIn)
{
<div class="width-100per">
<div class="width-100per text-align-center">

View File

@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.ModelBinding;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Microsoft.Extensions.Configuration;
using Newtonsoft.Json;
using RMuseum.Models.Ganjoor;
using RMuseum.Models.Ganjoor.ViewModels;
@ -25,13 +26,20 @@ namespace GanjooRazor.Pages
/// </summary>
private readonly HttpClient _httpClient;
/// <summary>
/// configuration
/// </summary>
private readonly IConfiguration Configuration;
/// <summary>
/// constructor
/// </summary>
/// <param name="httpClient"></param>
public BpModel(HttpClient httpClient)
/// <param name="configuration"></param>
public BpModel(HttpClient httpClient, IConfiguration configuration)
{
_httpClient = httpClient;
Configuration = configuration;
}
/// <summary>
@ -60,6 +68,17 @@ namespace GanjooRazor.Pages
/// </summary>
public int InsertedSongId { get; set; }
/// <summary>
/// readonly mode
/// </summary>
public bool ReadOnlyMode
{
get
{
return bool.Parse(Configuration["ReadOnlyMode"]);
}
}
/// <summary>
/// suggested (unapproved) songs
/// </summary>