ow
This commit is contained in:
1 parent
31fbe199c1
commit
1c0c83af5f
469 files changed
+62544
-5
No files matched your search
@@ -0,0 +1,52 @@
|
||||
using CloudBuilder.Core.DatabaseAccessor.Entity;
|
||||
using CloudBuilder.Core.Service;
|
||||
using CloudBuilder.Security.Data;
|
||||
using CloudBuilder.Security.Entity;
|
||||
using Microsoft.AspNetCore.Authorization;
|
||||
using Microsoft.AspNetCore.Http;
|
||||
using Microsoft.AspNetCore.Http.Features;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace CloudBuilder.Security.Service
|
||||
{
|
||||
public class YesNoPolicyService : IYesNoPolicyService
|
||||
{
|
||||
private readonly IApplicationService service;
|
||||
|
||||
public YesNoPolicyService(IApplicationService service)
|
||||
{
|
||||
this.service = service;
|
||||
}
|
||||
|
||||
[AllowAnonymous]
|
||||
[HttpPost]
|
||||
public SelectOption[] FindSelectOption(bool blank)
|
||||
{
|
||||
YesNoPolicy policy = YesNoPolicy.GetInstance();
|
||||
string[] values = policy.GetValues();
|
||||
List<SelectOption> l = new List<SelectOption>();
|
||||
|
||||
SelectOption selectOption;
|
||||
if (blank)
|
||||
{
|
||||
selectOption = new SelectOption();
|
||||
l.Add(selectOption);
|
||||
}
|
||||
|
||||
foreach (string value in values)
|
||||
{
|
||||
selectOption = new SelectOption();
|
||||
selectOption.BindValue = value;
|
||||
selectOption.DisplayName = policy.ComposeMessage(value, service.Locale);
|
||||
l.Add(selectOption);
|
||||
}
|
||||
return l.ToArray();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user