From 0bed7db506c3f6fad54455b63099bb0c891bd40b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Halil=20=C4=B0brahim=20Kalkan?= Date: Wed, 6 Dec 2017 15:58:15 +0300 Subject: [PATCH] Moved user create and edit to it's own pages. removed userscontroller. --- Volo.Abp.sln | 6 +- .../Identity/Controllers/UsersController.cs | 62 ----------------- .../Models/CreateOrUpdateUserViewModel.cs | 8 --- .../Areas/Identity/Views/Users/_Create.cshtml | 66 ------------------- .../Pages/Identity/Users/CreateModal.cshtml | 6 +- .../Identity/Users/CreateModal.cshtml.cs | 12 +--- .../Identity/Users/EditModal.cshtml} | 17 +++-- .../Pages/Identity/Users/EditModal.cshtml.cs | 42 ++++++++++++ .../Volo.Abp.Identity.Web.csproj | 4 ++ .../modules/identity/views/users/index.js | 6 +- 10 files changed, 71 insertions(+), 158 deletions(-) delete mode 100644 src/Volo.Abp.Identity.Web/Areas/Identity/Controllers/UsersController.cs delete mode 100644 src/Volo.Abp.Identity.Web/Areas/Identity/Models/CreateOrUpdateUserViewModel.cs delete mode 100644 src/Volo.Abp.Identity.Web/Areas/Identity/Views/Users/_Create.cshtml rename src/Volo.Abp.Identity.Web/{Areas/Identity/Views/Users/_Update.cshtml => Pages/Identity/Users/EditModal.cshtml} (88%) create mode 100644 src/Volo.Abp.Identity.Web/Pages/Identity/Users/EditModal.cshtml.cs diff --git a/Volo.Abp.sln b/Volo.Abp.sln index eeaf9e984f..a9a8c728f8 100644 --- a/Volo.Abp.sln +++ b/Volo.Abp.sln @@ -1,7 +1,7 @@  Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 -VisualStudioVersion = 15.0.27004.2005 +VisualStudioVersion = 15.0.27130.0 MinimumVisualStudioVersion = 10.0.40219.1 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5DF0E140-0513-4D0D-BE2E-3D4D85CD70E6}" EndProject @@ -154,9 +154,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Account.Applicatio EndProject Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.Account.Application.Contracts", "src\Volo.Abp.Account.Application.Contracts\Volo.Abp.Account.Application.Contracts.csproj", "{3E62ED84-8792-4DA6-9B0A-AADEA183C2B3}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.VirtualFileSystem", "src\Volo.Abp.VirtualFileSystem\Volo.Abp.VirtualFileSystem.csproj", "{6E6A7554-3488-45AB-BC0E-9BDE1F19789D}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.VirtualFileSystem", "src\Volo.Abp.VirtualFileSystem\Volo.Abp.VirtualFileSystem.csproj", "{6E6A7554-3488-45AB-BC0E-9BDE1F19789D}" EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Volo.Abp.VirtualFileSystem.Tests", "test\Volo.Abp.VirtualFileSystem.Tests\Volo.Abp.VirtualFileSystem.Tests.csproj", "{F79B6D80-C79B-4C13-9221-CA2345983743}" +Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Volo.Abp.VirtualFileSystem.Tests", "test\Volo.Abp.VirtualFileSystem.Tests\Volo.Abp.VirtualFileSystem.Tests.csproj", "{F79B6D80-C79B-4C13-9221-CA2345983743}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/src/Volo.Abp.Identity.Web/Areas/Identity/Controllers/UsersController.cs b/src/Volo.Abp.Identity.Web/Areas/Identity/Controllers/UsersController.cs deleted file mode 100644 index 01397cc0d2..0000000000 --- a/src/Volo.Abp.Identity.Web/Areas/Identity/Controllers/UsersController.cs +++ /dev/null @@ -1,62 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Mvc; -using Volo.Abp.AspNetCore.Mvc; -using Volo.Abp.Identity.Web.Areas.Identity.Models; - -namespace Volo.Abp.Identity.Web.Areas.Identity.Controllers -{ - //[Area("Identity")] - //[Authorize] - //public class UsersController : AbpController - //{ - // private readonly IIdentityUserAppService _identityUserAppService; - // private readonly IIdentityRoleAppService _identityRoleAppService; - - // public UsersController(IIdentityUserAppService identityUserAppService, IIdentityRoleAppService identityRoleAppService) - // { - // _identityUserAppService = identityUserAppService; - // _identityRoleAppService = identityRoleAppService; - // } - - // public async Task Update(Guid id) - // { - // var user = await _identityUserAppService.GetAsync(id); - // await _identityRoleAppService.GetAllListAsync(); - // var model = await CreateViewModel(user); - - // return PartialView("_Update", model); - // } - - // private async Task CreateViewModel(IdentityUserDto user) - // { - // var allRoles = await _identityRoleAppService.GetAllListAsync(); - - // var model = new CreateOrUpdateUserViewModel - // { - // User = user ?? new IdentityUserDto(), - // Roles = ObjectMapper.Map, IdentityUserRoleDto[]>(allRoles) - // }; - - // var userRoles = new List(); - - // if (user != null) - // { - // userRoles = (await _identityUserAppService.GetRolesAsync(user.Id)).Items.ToList(); - // } - - // foreach (var role in model.Roles) - // { - // if (userRoles.Select(x=>x.Name).Contains(role.Name)) - // { - // role.IsAssigned = true; - // } - // } - - // return model; - // } - //} -} diff --git a/src/Volo.Abp.Identity.Web/Areas/Identity/Models/CreateOrUpdateUserViewModel.cs b/src/Volo.Abp.Identity.Web/Areas/Identity/Models/CreateOrUpdateUserViewModel.cs deleted file mode 100644 index 5f92205779..0000000000 --- a/src/Volo.Abp.Identity.Web/Areas/Identity/Models/CreateOrUpdateUserViewModel.cs +++ /dev/null @@ -1,8 +0,0 @@ -namespace Volo.Abp.Identity.Web.Areas.Identity.Models -{ - public class CreateOrUpdateUserViewModel - { - public IdentityUserDto User { get; set; } - public IdentityUserRoleDto[] Roles { get; set; } - } -} diff --git a/src/Volo.Abp.Identity.Web/Areas/Identity/Views/Users/_Create.cshtml b/src/Volo.Abp.Identity.Web/Areas/Identity/Views/Users/_Create.cshtml deleted file mode 100644 index b4fe2ac4d6..0000000000 --- a/src/Volo.Abp.Identity.Web/Areas/Identity/Views/Users/_Create.cshtml +++ /dev/null @@ -1,66 +0,0 @@ -@using Microsoft.Extensions.Localization -@using Volo.Abp.Identity.Web.Areas.Identity.Localization.Resource -@model Volo.Abp.Identity.Web.Areas.Identity.Models.CreateOrUpdateUserViewModel -@inject IStringLocalizer Localizer - - - \ No newline at end of file diff --git a/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml b/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml index 4fa963db83..3f2a2a9020 100644 --- a/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml +++ b/src/Volo.Abp.Identity.Web/Pages/Identity/Users/CreateModal.cshtml @@ -1,8 +1,12 @@ -@using Microsoft.Extensions.Localization +@page +@using Microsoft.Extensions.Localization @using Volo.Abp.Identity.Web.Areas.Identity.Localization.Resource @using Volo.Abp.Identity.Web.Pages.Identity.Users @model CreateModalModel @inject IStringLocalizer Localizer +@{ + Layout = null; +}