From cd57fc46bc3ba74c6f3a7ed31dda144af9f17810 Mon Sep 17 00:00:00 2001 From: ivanszabo Date: Thu, 10 Apr 2025 13:37:39 +0200 Subject: [PATCH] =?UTF-8?q?Felhaszn=C3=A1l=C3=B3=20=C3=A9s=20szab=C3=A1ly?= =?UTF-8?q?=20t=C3=B6rl=C3=A9s=C3=A9nek=20befejez=C3=A9se?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/UserController.cs | 45 + .../Services/Interfaces/IUserService.cs | 3 + src/WorkFlowCheck.BL/Services/UserService.cs | 25 +- src/WorkFlowCheck.Common/DTO/RoleDTO.cs | 10 + src/WorkFlowCheck.DL/Entities/Role.cs | 2 + .../20250410095014_Extend020.Designer.cs | 963 ++++++++++++++++++ .../Migrations/20250410095014_Extend020.cs | 69 ++ .../Migrations/AppDbContextModelSnapshot.cs | 14 +- .../Pages/UserAndRole/RoleEditPage.cshtml | 20 +- .../Pages/UserAndRole/RolePage.cshtml | 37 +- .../Pages/UserAndRole/RolePage.cshtml.cs | 5 + .../Pages/UserAndRole/UserPage.cshtml | 12 +- .../Pages/UserAndRole/UserPage.cshtml.cs | 5 + .../Services/Interfaces/IUserService.cs | 2 + src/WorkFlowCheck.Web/Services/UserService.cs | 44 +- .../appsettings.Development.json | 1 + 16 files changed, 1218 insertions(+), 39 deletions(-) create mode 100644 src/WorkFlowCheck.DL/Migrations/20250410095014_Extend020.Designer.cs create mode 100644 src/WorkFlowCheck.DL/Migrations/20250410095014_Extend020.cs diff --git a/src/WorkFlowCheck.API/Controllers/UserController.cs b/src/WorkFlowCheck.API/Controllers/UserController.cs index 0387f22..0be37d8 100644 --- a/src/WorkFlowCheck.API/Controllers/UserController.cs +++ b/src/WorkFlowCheck.API/Controllers/UserController.cs @@ -71,6 +71,28 @@ namespace WorkFlowCheck.API.Controllers return retVal; } + [HttpGet("DeleteUser/{id}")] + public async Task> DeleteUser(int id) + { + var retVal = new ApiResponseDTO() + { + IsSuccess = true, + }; + var result = await _userService.DeleteUserAsync(id); + + if (result != null) + { + retVal.IsSuccess = true; + retVal.Data = result; + } + else + { + retVal.IsSuccess = false; + retVal.Errors.Add("No data!"); + } + + return retVal; + } [HttpPost("UpdateUser")] public async Task> UpdateUser([FromBody] UserDTO userDTO) { @@ -187,6 +209,7 @@ namespace WorkFlowCheck.API.Controllers return retVal; } + [HttpGet("GetRole/{id}")] public async Task> GetRole(int id) { @@ -316,6 +339,28 @@ namespace WorkFlowCheck.API.Controllers return retVal; } + [HttpGet("DeleteRole/{id}")] + public async Task> DeleteRole(int id) + { + var retVal = new ApiResponseDTO() + { + IsSuccess = true, + }; + var result = await _userService.DeleteRoleAsync(id); + + if (result != null) + { + retVal.IsSuccess = true; + retVal.Data = result; + } + else + { + retVal.IsSuccess = false; + retVal.Errors.Add("No data!"); + } + + return retVal; + } [HttpPost("UpdateUserRole")] public async Task> UpdateUserRole([FromBody] UserRoleDTO userRoleDTO) { diff --git a/src/WorkFlowCheck.BL/Services/Interfaces/IUserService.cs b/src/WorkFlowCheck.BL/Services/Interfaces/IUserService.cs index 24b66a1..7d6ed2f 100644 --- a/src/WorkFlowCheck.BL/Services/Interfaces/IUserService.cs +++ b/src/WorkFlowCheck.BL/Services/Interfaces/IUserService.cs @@ -11,12 +11,15 @@ namespace WorkFlowCheck.BL.Services.Interfaces { Task GetUserAsync(int Id); Task> GetAllUserAsync(); + Task DeleteUserAsync(int Id); Task UpdateUserAsync(UserDTO userDTO); Task Authenticate(string UserName, string Password); Task AuthenticateNFC(string NFCCode); + Task GetRoleAsync(int Id); Task> GetAllRoleAsync(); + Task DeleteRoleAsync(int Id); Task UpdateRoleAsync(RoleDTO roleDTO); Task GetUserRoleAsync(int Id); diff --git a/src/WorkFlowCheck.BL/Services/UserService.cs b/src/WorkFlowCheck.BL/Services/UserService.cs index da78b07..b2a2344 100644 --- a/src/WorkFlowCheck.BL/Services/UserService.cs +++ b/src/WorkFlowCheck.BL/Services/UserService.cs @@ -19,16 +19,13 @@ using Microsoft.AspNetCore.Identity; namespace WorkFlowCheck.BL.Services { - public class UserService : IUserService + public class UserService : BaseService, IUserService { - private AppDbContext _dbContext; - private IMapper _mapper; private IConfiguration _configuration; - public UserService(AppDbContext dbContext, IMapper mapper, IConfiguration configuration) + public UserService(AppDbContext dbContext, IMapper mapper, IConfiguration configuration) : base(dbContext, mapper) { - _dbContext = dbContext; - _mapper = mapper; + _configuration = configuration; } @@ -76,6 +73,10 @@ namespace WorkFlowCheck.BL.Services } return retVal; } + public async Task DeleteUserAsync(int id) + { + return await DeleteEntityByIdAsync(id); + } public async Task Authenticate(string userName, string password) { var retVal = new UserDTO() { RoleDTO = new List() }; @@ -199,12 +200,12 @@ namespace WorkFlowCheck.BL.Services user.LastName = userDTO.LastName; user.Email = userDTO.Email; user.NFCActive = userDTO.NFCActive; - user.NFCCode = userDTO.NFCCode; + user.NFCCode = userDTO.NFCCode; user.JwtToken = ""; user.Token2FA = ""; user.IsDeleted = false; user.Active = userDTO.Active; - + user.PasswordHash = PasswordHasher.HashPassword(userDTO.Password); @@ -275,6 +276,10 @@ namespace WorkFlowCheck.BL.Services } return retVal; } + public async Task DeleteRoleAsync(int id) + { + return await DeleteEntityByIdAsync(id); + } public async Task UpdateRoleAsync(RoleDTO roleDTO) { var retVal = new RoleDTO(); @@ -291,6 +296,8 @@ namespace WorkFlowCheck.BL.Services role.IsAdmin = roleDTO.IsAdmin; role.CanDownloadAPK = roleDTO.CanDownloadAPK; role.CanEnableBlocked = roleDTO.CanEnableBlocked; + role.CanUseWebAdmin = roleDTO.CanUseWebAdmin; + role.CanUseMobilApp = roleDTO.CanUseMobilApp; _dbContext.Roles.Add(role); await _dbContext.SaveChangesAsync(); @@ -310,6 +317,8 @@ namespace WorkFlowCheck.BL.Services role.IsAdmin = roleDTO.IsAdmin; role.CanDownloadAPK = roleDTO.CanDownloadAPK; role.CanEnableBlocked = roleDTO.CanEnableBlocked; + role.CanUseWebAdmin = roleDTO.CanUseWebAdmin; + role.CanUseMobilApp = roleDTO.CanUseMobilApp; await _dbContext.SaveChangesAsync(); retVal = _mapper.Map(role); diff --git a/src/WorkFlowCheck.Common/DTO/RoleDTO.cs b/src/WorkFlowCheck.Common/DTO/RoleDTO.cs index e71717e..9b2f3bf 100644 --- a/src/WorkFlowCheck.Common/DTO/RoleDTO.cs +++ b/src/WorkFlowCheck.Common/DTO/RoleDTO.cs @@ -15,11 +15,21 @@ namespace WorkFlowCheck.Common.DTO [DisplayName("Szülő szerepkör neve")] public string? ParentRoleName { get; set; } + [DisplayName("Adminisztrátor?")] public bool IsAdmin { get; set; } + [DisplayName("Új program letöltés?")] public bool CanDownloadAPK { get; set; } + [DisplayName("Folyamat blokk/engedélyez?")] public bool CanEnableBlocked { get; set; } + + [DisplayName("WEB felület?")] + public bool CanUseWebAdmin { get; set; } + + [DisplayName("Mobil App?")] + public bool CanUseMobilApp { get; set; } } + } diff --git a/src/WorkFlowCheck.DL/Entities/Role.cs b/src/WorkFlowCheck.DL/Entities/Role.cs index 8576142..cb586fb 100644 --- a/src/WorkFlowCheck.DL/Entities/Role.cs +++ b/src/WorkFlowCheck.DL/Entities/Role.cs @@ -17,6 +17,8 @@ namespace WorkFlowCheck.DL.Entities public bool IsAdmin { get; set; } public bool CanDownloadAPK { get; set; } public bool CanEnableBlocked { get; set; } + public bool CanUseWebAdmin { get; set; } + public bool CanUseMobilApp { get; set; } public virtual ICollection Children { get; set; } = new List(); public virtual ICollection UserRoles { get; set; } = new List(); diff --git a/src/WorkFlowCheck.DL/Migrations/20250410095014_Extend020.Designer.cs b/src/WorkFlowCheck.DL/Migrations/20250410095014_Extend020.Designer.cs new file mode 100644 index 0000000..c37e6d6 --- /dev/null +++ b/src/WorkFlowCheck.DL/Migrations/20250410095014_Extend020.Designer.cs @@ -0,0 +1,963 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using WorkFlowCheck.DL; + +#nullable disable + +namespace WorkFlowCheck.DL.Migrations +{ + [DbContext(typeof(AppDbContext))] + [Migration("20250410095014_Extend020")] + partial class Extend020 + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.12") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListHeader", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AcceptUserId") + .HasColumnType("int"); + + b.Property("CheckListTemplateHeaderId") + .HasColumnType("int"); + + b.Property("CheckStatus") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DateExecution") + .HasColumnType("datetime2"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DocumentNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("GuidNumber") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsEditable") + .HasColumnType("bit"); + + b.Property("IsStorno") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("AcceptUserId"); + + b.HasIndex("CheckListTemplateHeaderId"); + + b.HasIndex("UserId"); + + b.ToTable("CheckListHeader", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListRow", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Answer") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CheckListHeaderId") + .HasColumnType("int"); + + b.Property("CheckListTemplateRowId") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("GuidNumber") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("PhotoFileName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("CheckListHeaderId"); + + b.HasIndex("CheckListTemplateRowId"); + + b.ToTable("CheckListRow", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Description") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("NumberGenerator1Id") + .HasColumnType("int"); + + b.Property("NumberGenerator2Id") + .HasColumnType("int"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("NumberGenerator1Id"); + + b.HasIndex("NumberGenerator2Id"); + + b.ToTable("CheckListTemplateHeader", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateRow", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AnswerType") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CheckListTemplateHeaderId") + .HasColumnType("int"); + + b.Property("CheckPointId") + .HasColumnType("int"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EquipmentId") + .HasColumnType("int"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("OperationDescription") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("RowIndex") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CheckListTemplateHeaderId"); + + b.HasIndex("CheckPointId"); + + b.HasIndex("EquipmentId"); + + b.ToTable("CheckListTemplateRow", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckPoint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Code") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("IsEnabled") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("CheckPoint", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.DeviceMessage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("DeviceIdFrom") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("DeviceIdTo") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ExtraDataJSON") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsReaded") + .HasColumnType("bit"); + + b.Property("Message") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ReceiveDate") + .HasColumnType("datetime2"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("SendDate") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("DeviceIdTo") + .HasDatabaseName("IX_DeviceMessage_DeviceIdTo"); + + b.HasIndex("RoleId"); + + b.ToTable("DeviceMessage", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.Equipment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("EquipmentNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Equipment", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.Location", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FullName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Location", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.NumberGeneratorTemplate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CurrentNumber") + .HasColumnType("int"); + + b.Property("DigitFormat") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("GenerateType") + .HasColumnType("int"); + + b.Property("LastGeneratedNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Prefix") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("PrefixSeparator") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ShortName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Suffix") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("SuffixSeparator") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("NumberGeneratorTemplate", (string)null); + + b.HasData( + new + { + Id = 1, + CurrentNumber = 0, + DigitFormat = "D4", + GenerateType = 0, + LastGeneratedNumber = "", + Prefix = "CHK", + PrefixSeparator = "-", + ShortName = "Ellenőrzési dokumentum sorszámozása", + Suffix = "", + SuffixSeparator = "-" + }); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.NumberGeneratorTemplateDate", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CurrentNumber") + .HasColumnType("int"); + + b.Property("LastGeneratedNumber") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Month") + .HasColumnType("int"); + + b.Property("NumberGeneratorTemplateId") + .HasColumnType("int"); + + b.Property("Year") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("NumberGeneratorTemplateId"); + + b.ToTable("NumberGeneratorTemplateDate", (string)null); + + b.HasData( + new + { + Id = 1, + CurrentNumber = 0, + LastGeneratedNumber = "", + Month = 0, + NumberGeneratorTemplateId = 1, + Year = 1 + }); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.Role", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CanDownloadAPK") + .HasColumnType("bit"); + + b.Property("CanEnableBlocked") + .HasColumnType("bit"); + + b.Property("CanUseMobilApp") + .HasColumnType("bit"); + + b.Property("CanUseWebAdmin") + .HasColumnType("bit"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsAdmin") + .HasColumnType("bit"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ParentId") + .HasColumnType("int"); + + b.Property("RoleName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.ToTable("Roles", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.RoleCheckListTemplateHeader", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CheckListTemplateHeaderId") + .HasColumnType("int"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CheckListTemplateHeaderId"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleCheckListTemplateHeader", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.RoleCheckPoint", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CheckPointId") + .HasColumnType("int"); + + b.Property("Enabled") + .HasColumnType("bit"); + + b.Property("RoleId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CheckPointId"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleCheckPoint", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Active") + .HasColumnType("bit"); + + b.Property("CreatedAt") + .HasColumnType("datetime2"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("IsDeleted") + .HasColumnType("bit"); + + b.Property("JwtToken") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastModAt") + .HasColumnType("datetime2"); + + b.Property("LastModBy") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("NFCActive") + .HasColumnType("bit"); + + b.Property("NFCCode") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("PasswordHash") + .HasColumnType("nvarchar(max)"); + + b.Property("Token2FA") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("UserName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Users", (string)null); + + b.HasData( + new + { + Id = 1, + Active = true, + CreatedAt = new DateTime(2025, 4, 10, 9, 50, 12, 488, DateTimeKind.Utc).AddTicks(1377), + CreatedBy = "System", + Email = "admin@nuvolar.hu", + FirstName = "Administrator", + IsDeleted = false, + JwtToken = "", + LastModAt = new DateTime(2025, 4, 10, 9, 50, 12, 488, DateTimeKind.Utc).AddTicks(1382), + LastModBy = "System", + LastName = "System", + NFCActive = true, + NFCCode = "00000000", + PasswordHash = "eGM0NUREZnJ0ISFFRDIxMKE5TYwthDBuUsTUEO1fBnCR3VdSCmdz47ue0RoVvnkY", + Token2FA = "", + UserName = "admin" + }, + new + { + Id = 2, + Active = true, + CreatedAt = new DateTime(2025, 4, 10, 9, 50, 12, 499, DateTimeKind.Utc).AddTicks(4095), + CreatedBy = "System", + Email = "user@nuvolar.hu", + FirstName = "User", + IsDeleted = false, + JwtToken = "", + LastModAt = new DateTime(2025, 4, 10, 9, 50, 12, 499, DateTimeKind.Utc).AddTicks(4096), + LastModBy = "System", + LastName = "System", + NFCActive = true, + NFCCode = "00000000", + PasswordHash = "eGM0NUREZnJ0ISFFRDIxMPwM2D9sQSj7zmaSBIsOGe0I9hBFwCGPVbyrYMA5EnKG", + Token2FA = "", + UserName = "user" + }); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.UserRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("RoleId") + .HasColumnType("int"); + + b.Property("UserId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.HasIndex("UserId"); + + b.ToTable("UserRoles", (string)null); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListHeader", b => + { + b.HasOne("WorkFlowCheck.DL.Entities.User", "AcceptUser") + .WithMany() + .HasForeignKey("AcceptUserId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", "CheckListTemplateHeader") + .WithMany() + .HasForeignKey("CheckListTemplateHeaderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WorkFlowCheck.DL.Entities.User", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("AcceptUser"); + + b.Navigation("CheckListTemplateHeader"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListRow", b => + { + b.HasOne("WorkFlowCheck.DL.Entities.CheckListHeader", "CheckListHeader") + .WithMany("CheckListRows") + .HasForeignKey("CheckListHeaderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateRow", "CheckListTemplateRow") + .WithMany() + .HasForeignKey("CheckListTemplateRowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CheckListHeader"); + + b.Navigation("CheckListTemplateRow"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", b => + { + b.HasOne("WorkFlowCheck.DL.Entities.NumberGeneratorTemplate", "NumberGenerator1") + .WithMany() + .HasForeignKey("NumberGenerator1Id"); + + b.HasOne("WorkFlowCheck.DL.Entities.NumberGeneratorTemplate", "NumberGenerator2") + .WithMany() + .HasForeignKey("NumberGenerator2Id"); + + b.Navigation("NumberGenerator1"); + + b.Navigation("NumberGenerator2"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateRow", b => + { + b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", "CheckListTemplateHeader") + .WithMany("CheckListTemplateRows") + .HasForeignKey("CheckListTemplateHeaderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WorkFlowCheck.DL.Entities.CheckPoint", "CheckPoint") + .WithMany("CheckListTemplateRows") + .HasForeignKey("CheckPointId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WorkFlowCheck.DL.Entities.Equipment", "Equipment") + .WithMany() + .HasForeignKey("EquipmentId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CheckListTemplateHeader"); + + b.Navigation("CheckPoint"); + + b.Navigation("Equipment"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.DeviceMessage", b => + { + b.HasOne("WorkFlowCheck.DL.Entities.Role", "Role") + .WithMany() + .HasForeignKey("RoleId"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.NumberGeneratorTemplateDate", b => + { + b.HasOne("WorkFlowCheck.DL.Entities.NumberGeneratorTemplate", "NumberGeneratorTemplate") + .WithMany("NumberGeneratorTemplateDates") + .HasForeignKey("NumberGeneratorTemplateId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("NumberGeneratorTemplate"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.Role", b => + { + b.HasOne("WorkFlowCheck.DL.Entities.Role", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.RoleCheckListTemplateHeader", b => + { + b.HasOne("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", "CheckListTemplateHeader") + .WithMany() + .HasForeignKey("CheckListTemplateHeaderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WorkFlowCheck.DL.Entities.Role", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CheckListTemplateHeader"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.RoleCheckPoint", b => + { + b.HasOne("WorkFlowCheck.DL.Entities.CheckPoint", "CheckPoint") + .WithMany() + .HasForeignKey("CheckPointId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("WorkFlowCheck.DL.Entities.Role", "Role") + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CheckPoint"); + + b.Navigation("Role"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.UserRole", b => + { + b.HasOne("WorkFlowCheck.DL.Entities.Role", "Role") + .WithMany("UserRoles") + .HasForeignKey("RoleId"); + + b.HasOne("WorkFlowCheck.DL.Entities.User", "User") + .WithMany("UserRoles") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Role"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListHeader", b => + { + b.Navigation("CheckListRows"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckListTemplateHeader", b => + { + b.Navigation("CheckListTemplateRows"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.CheckPoint", b => + { + b.Navigation("CheckListTemplateRows"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.NumberGeneratorTemplate", b => + { + b.Navigation("NumberGeneratorTemplateDates"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.Role", b => + { + b.Navigation("Children"); + + b.Navigation("UserRoles"); + }); + + modelBuilder.Entity("WorkFlowCheck.DL.Entities.User", b => + { + b.Navigation("UserRoles"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/src/WorkFlowCheck.DL/Migrations/20250410095014_Extend020.cs b/src/WorkFlowCheck.DL/Migrations/20250410095014_Extend020.cs new file mode 100644 index 0000000..573262f --- /dev/null +++ b/src/WorkFlowCheck.DL/Migrations/20250410095014_Extend020.cs @@ -0,0 +1,69 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace WorkFlowCheck.DL.Migrations +{ + /// + public partial class Extend020 : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "CanUseMobilApp", + table: "Roles", + type: "bit", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "CanUseWebAdmin", + table: "Roles", + type: "bit", + nullable: false, + defaultValue: false); + + migrationBuilder.UpdateData( + table: "Users", + keyColumn: "Id", + keyValue: 1, + columns: new[] { "CreatedAt", "LastModAt" }, + values: new object[] { new DateTime(2025, 4, 10, 9, 50, 12, 488, DateTimeKind.Utc).AddTicks(1377), new DateTime(2025, 4, 10, 9, 50, 12, 488, DateTimeKind.Utc).AddTicks(1382) }); + + migrationBuilder.UpdateData( + table: "Users", + keyColumn: "Id", + keyValue: 2, + columns: new[] { "CreatedAt", "LastModAt" }, + values: new object[] { new DateTime(2025, 4, 10, 9, 50, 12, 499, DateTimeKind.Utc).AddTicks(4095), new DateTime(2025, 4, 10, 9, 50, 12, 499, DateTimeKind.Utc).AddTicks(4096) }); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "CanUseMobilApp", + table: "Roles"); + + migrationBuilder.DropColumn( + name: "CanUseWebAdmin", + table: "Roles"); + + migrationBuilder.UpdateData( + table: "Users", + keyColumn: "Id", + keyValue: 1, + columns: new[] { "CreatedAt", "LastModAt" }, + values: new object[] { new DateTime(2025, 4, 8, 10, 50, 38, 70, DateTimeKind.Utc).AddTicks(7907), new DateTime(2025, 4, 8, 10, 50, 38, 70, DateTimeKind.Utc).AddTicks(7910) }); + + migrationBuilder.UpdateData( + table: "Users", + keyColumn: "Id", + keyValue: 2, + columns: new[] { "CreatedAt", "LastModAt" }, + values: new object[] { new DateTime(2025, 4, 8, 10, 50, 38, 83, DateTimeKind.Utc).AddTicks(1759), new DateTime(2025, 4, 8, 10, 50, 38, 83, DateTimeKind.Utc).AddTicks(1761) }); + } + } +} diff --git a/src/WorkFlowCheck.DL/Migrations/AppDbContextModelSnapshot.cs b/src/WorkFlowCheck.DL/Migrations/AppDbContextModelSnapshot.cs index 84ff4e1..ef908ed 100644 --- a/src/WorkFlowCheck.DL/Migrations/AppDbContextModelSnapshot.cs +++ b/src/WorkFlowCheck.DL/Migrations/AppDbContextModelSnapshot.cs @@ -529,6 +529,12 @@ namespace WorkFlowCheck.DL.Migrations b.Property("CanEnableBlocked") .HasColumnType("bit"); + b.Property("CanUseMobilApp") + .HasColumnType("bit"); + + b.Property("CanUseWebAdmin") + .HasColumnType("bit"); + b.Property("CreatedAt") .HasColumnType("datetime2"); @@ -686,13 +692,13 @@ namespace WorkFlowCheck.DL.Migrations { Id = 1, Active = true, - CreatedAt = new DateTime(2025, 4, 8, 10, 50, 38, 70, DateTimeKind.Utc).AddTicks(7907), + CreatedAt = new DateTime(2025, 4, 10, 9, 50, 12, 488, DateTimeKind.Utc).AddTicks(1377), CreatedBy = "System", Email = "admin@nuvolar.hu", FirstName = "Administrator", IsDeleted = false, JwtToken = "", - LastModAt = new DateTime(2025, 4, 8, 10, 50, 38, 70, DateTimeKind.Utc).AddTicks(7910), + LastModAt = new DateTime(2025, 4, 10, 9, 50, 12, 488, DateTimeKind.Utc).AddTicks(1382), LastModBy = "System", LastName = "System", NFCActive = true, @@ -705,13 +711,13 @@ namespace WorkFlowCheck.DL.Migrations { Id = 2, Active = true, - CreatedAt = new DateTime(2025, 4, 8, 10, 50, 38, 83, DateTimeKind.Utc).AddTicks(1759), + CreatedAt = new DateTime(2025, 4, 10, 9, 50, 12, 499, DateTimeKind.Utc).AddTicks(4095), CreatedBy = "System", Email = "user@nuvolar.hu", FirstName = "User", IsDeleted = false, JwtToken = "", - LastModAt = new DateTime(2025, 4, 8, 10, 50, 38, 83, DateTimeKind.Utc).AddTicks(1761), + LastModAt = new DateTime(2025, 4, 10, 9, 50, 12, 499, DateTimeKind.Utc).AddTicks(4096), LastModBy = "System", LastName = "System", NFCActive = true, diff --git a/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleEditPage.cshtml b/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleEditPage.cshtml index 1522035..f98be30 100644 --- a/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleEditPage.cshtml +++ b/src/WorkFlowCheck.Web/Pages/UserAndRole/RoleEditPage.cshtml @@ -26,14 +26,14 @@
-
+
-
+
@@ -47,6 +47,20 @@
+
+
+ + + +
+
+
+
+ + + +
+

@@ -66,6 +80,8 @@ formData.RoleDTO.IsAdmin = $('#RoleForm input[name="RoleDTO.IsAdmin"]').is(':checked'); formData.RoleDTO.CanDownloadAPK = $('#RoleForm input[name="RoleDTO.CanDownloadAPK"]').is(':checked'); formData.RoleDTO.CanEnableBlocked = $('#RoleForm input[name="RoleDTO.CanEnableBlocked"]').is(':checked'); + formData.RoleDTO.CanUseMobilApp = $('#RoleForm input[name="RoleDTO.CanUseMobilApp"]').is(':checked'); + formData.RoleDTO.CanUseWebAdmin = $('#RoleForm input[name="RoleDTO.CanUseWebAdmin"]').is(':checked'); if ($form.valid()) { diff --git a/src/WorkFlowCheck.Web/Pages/UserAndRole/RolePage.cshtml b/src/WorkFlowCheck.Web/Pages/UserAndRole/RolePage.cshtml index 4fc7857..2876353 100644 --- a/src/WorkFlowCheck.Web/Pages/UserAndRole/RolePage.cshtml +++ b/src/WorkFlowCheck.Web/Pages/UserAndRole/RolePage.cshtml @@ -23,6 +23,8 @@ @DisplayNameHelper.GetDisplayName(nameof(RoleDTO.IsAdmin), typeof(RoleDTO)) @DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanEnableBlocked), typeof(RoleDTO)) @DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanDownloadAPK), typeof(RoleDTO)) + @DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseMobilApp), typeof(RoleDTO)) + @DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseWebAdmin), typeof(RoleDTO)) Action @@ -34,6 +36,8 @@ @DisplayNameHelper.GetDisplayName(nameof(RoleDTO.IsAdmin), typeof(RoleDTO)) @DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanEnableBlocked), typeof(RoleDTO)) @DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanDownloadAPK), typeof(RoleDTO)) + @DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseMobilApp), typeof(RoleDTO)) + @DisplayNameHelper.GetDisplayName(nameof(RoleDTO.CanUseWebAdmin), typeof(RoleDTO)) Action @@ -82,6 +86,25 @@ } }, + { + data: "canUseMobilApp", + searchable: false, + sortable: false, + className: "text-center", + render: function ( data, type, row ) { + return renderCheckBox(data); + } + + }, + { + data: "canUseWebAdmin", + searchable: false, + sortable: false, + className: "text-center", + render: function ( data, type, row ) { + return renderCheckBox(data); + } + }, { data: null, render: function (data, type, row) { return renderActionButtons(row.id); }} @@ -92,7 +115,7 @@ "visible": false }, { - "targets": 6, + "targets": 8, "className": "text-center", "width": "10%" } @@ -117,17 +140,7 @@ $('#tbRolesPage').on('click', '.delete-btn', function () { const row = table.row($(this).closest('tr')).data(); - console.log(row); - showConfirmModal({ - title: 'Törlés megerősítése', - message: 'Biztosan törölni szeretnéd ezt az elemet?', - okText: 'Törlés', - cancelText: 'Mégsem' - }).then(function(result) { - if(result === 'ok') { - console.log('Törlés végrehajtva'); - } - }); + deleteEntity(table, '/UserAndRole/UserRole?handler=DeleteUser', row.id); }); } diff --git a/src/WorkFlowCheck.Web/Pages/UserAndRole/RolePage.cshtml.cs b/src/WorkFlowCheck.Web/Pages/UserAndRole/RolePage.cshtml.cs index a804b29..b7f6af4 100644 --- a/src/WorkFlowCheck.Web/Pages/UserAndRole/RolePage.cshtml.cs +++ b/src/WorkFlowCheck.Web/Pages/UserAndRole/RolePage.cshtml.cs @@ -21,5 +21,10 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole var results = await _userService.GetAllRoles(); return new JsonResult(new { data = results }); } + public async Task OnGetDeleteRole(int id) + { + var isSuccess = await _userService.DeleteRole(id); + return new JsonResult(new { result = isSuccess }); + } } } diff --git a/src/WorkFlowCheck.Web/Pages/UserAndRole/UserPage.cshtml b/src/WorkFlowCheck.Web/Pages/UserAndRole/UserPage.cshtml index ebe94e7..f2350bb 100644 --- a/src/WorkFlowCheck.Web/Pages/UserAndRole/UserPage.cshtml +++ b/src/WorkFlowCheck.Web/Pages/UserAndRole/UserPage.cshtml @@ -110,17 +110,7 @@ $('#tbUsersPage').on('click', '.delete-btn', function () { const row = table.row($(this).closest('tr')).data(); - console.log(row); - showConfirmModal({ - title: 'Törlés megerősítése', - message: 'Biztosan törölni szeretnéd ezt az elemet?', - okText: 'Törlés', - cancelText: 'Mégsem' - }).then(function(result) { - if(result === 'ok') { - console.log('Törlés végrehajtva'); - } - }); + deleteEntity(table, '/UserAndRole/UserPage?handler=DeleteUser', row.id); }); } diff --git a/src/WorkFlowCheck.Web/Pages/UserAndRole/UserPage.cshtml.cs b/src/WorkFlowCheck.Web/Pages/UserAndRole/UserPage.cshtml.cs index 71d8cde..10a117d 100644 --- a/src/WorkFlowCheck.Web/Pages/UserAndRole/UserPage.cshtml.cs +++ b/src/WorkFlowCheck.Web/Pages/UserAndRole/UserPage.cshtml.cs @@ -22,5 +22,10 @@ namespace WorkFlowCheck.Web.Pages.UserAndRole var results = await _userService.GetAllUsers(); return new JsonResult(new { data = results }); } + public async Task OnGetDeleteUser(int id) + { + var isSuccess = await _userService.DeleteUser(id); + return new JsonResult(new { result = isSuccess }); + } } } diff --git a/src/WorkFlowCheck.Web/Services/Interfaces/IUserService.cs b/src/WorkFlowCheck.Web/Services/Interfaces/IUserService.cs index ee4b100..cd5761e 100644 --- a/src/WorkFlowCheck.Web/Services/Interfaces/IUserService.cs +++ b/src/WorkFlowCheck.Web/Services/Interfaces/IUserService.cs @@ -8,10 +8,12 @@ namespace WorkFlowCheck.Web.Services.Interfaces Task> GetAllUsers(); Task> UpdateUser(UserDTO userDTO); Task> Authenticate(string username, string password); + Task DeleteUser(int id); Task GetRole(int id); Task> GetAllRoles(); Task> UpdateRole(RoleDTO roleDTO); + Task DeleteRole(int id); Task GetUserRole(int id); Task> GetAllUserRoles(); diff --git a/src/WorkFlowCheck.Web/Services/UserService.cs b/src/WorkFlowCheck.Web/Services/UserService.cs index 8b0a6da..021bae2 100644 --- a/src/WorkFlowCheck.Web/Services/UserService.cs +++ b/src/WorkFlowCheck.Web/Services/UserService.cs @@ -120,7 +120,27 @@ namespace WorkFlowCheck.Web.Services }; } } - + public async Task DeleteUser(int id) + { + string endpoint = $"{_httpClient.BaseAddress}api/User/DeleteUser/{id}"; + var retVal = false; + try + { + var response = await _httpClient.GetFromJsonAsync>(endpoint); + if (response != null) + { + if (response.IsSuccess) + { + return response.Data; + } + } + } + catch (Exception ex) + { + Log.Error(ex.Message); + } + return retVal; + } public async Task GetRole(int id) { @@ -192,7 +212,27 @@ namespace WorkFlowCheck.Web.Services }; } } - + public async Task DeleteRole(int id) + { + string endpoint = $"{_httpClient.BaseAddress}api/User/DeleteRole/{id}"; + var retVal = false; + try + { + var response = await _httpClient.GetFromJsonAsync>(endpoint); + if (response != null) + { + if (response.IsSuccess) + { + return response.Data; + } + } + } + catch (Exception ex) + { + Log.Error(ex.Message); + } + return retVal; + } public async Task GetUserRole(int id) { diff --git a/src/WorkFlowCheck.Web/appsettings.Development.json b/src/WorkFlowCheck.Web/appsettings.Development.json index 770d3e9..8f8a3ec 100644 --- a/src/WorkFlowCheck.Web/appsettings.Development.json +++ b/src/WorkFlowCheck.Web/appsettings.Development.json @@ -1,4 +1,5 @@ { + "ApiBaseUrl": "https://localhost:44382/", "DetailedErrors": true, "Logging": { "LogLevel": {