-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathIndex.cshtml.cs
More file actions
63 lines (54 loc) · 2.05 KB
/
Index.cshtml.cs
File metadata and controls
63 lines (54 loc) · 2.05 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Rendering;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Unity.Modules.Shared.Permissions;
using Volo.Abp.Identity;
using Volo.Abp.Identity.Integration;
namespace Unity.GrantManager.Web.Pages.GrantApplications
{
[Authorize]
public class IndexModel : GrantManagerPageModel
{
[BindProperty]
public Guid AssigneeId { get; set; }
public List<SelectListItem> AssigneeList { get; set; } = new();
[BindProperty(SupportsGet = true)]
public Guid? FormId { get; set; }
public IReadOnlyList<IdentityUserDto> Users { get; set; } = new List<IdentityUserDto>();
private readonly IIdentityUserIntegrationService _identityUserLookupAppService;
public IndexModel(IIdentityUserIntegrationService identityUserLookupAppService)
{
_identityUserLookupAppService = identityUserLookupAppService ?? throw new ArgumentNullException(nameof(identityUserLookupAppService));
}
public async Task OnGetAsync()
{
try
{
if (User.IsInRole(IdentityConsts.ITAdminRoleName))
{
Response.Redirect("/TenantManagement/Tenants");
return;
}
var users = (await _identityUserLookupAppService.SearchAsync(new UserLookupSearchInputDto())).Items;
AssigneeList ??= new List<SelectListItem>();
foreach (var user in users.OrderBy(s => s.UserName))
{
AssigneeList.Add(new()
{
Value = user.Id.ToString(),
Text = $"{user.Name} {user.Surname}",
});
}
}
catch (Exception ex)
{
Logger.LogError(ex, message: "Error loading users select list");
}
}
}
}