edit pmRole completed
This commit is contained in:
@@ -144,20 +144,16 @@ public class RoleApplication : IRoleApplication
|
||||
//اگر این نقش در پروگرام منیجر وجود داشت ویرایش کن
|
||||
if (pmRoleResult != null)
|
||||
{
|
||||
|
||||
try
|
||||
{
|
||||
var pmpermissionsData = pmPermissions.Where(x => x > 0).Select(x => new PmPermission(x)).ToList();
|
||||
//pmRoleResult.Edit(command.Name, pmpermissionsData);
|
||||
// await _pmRoleRepository.SaveChangesAsync();
|
||||
}
|
||||
catch (System.Exception)
|
||||
var edit = new CreatePmRoleDto { RoleName = command.Name, Permissions = pmPermissions, GozareshgirRoleId = role.id };
|
||||
var res = await _pmRoleCommandService.Edit(edit);
|
||||
if (!res.Item1)
|
||||
{
|
||||
_unitOfWork.RollbackAccountContext();
|
||||
return operation.Failed("خطا در ویرایش دسترسی ها در پروگرام منیجر");
|
||||
}
|
||||
|
||||
|
||||
|
||||
//var parameters = new CreateProgramManagerRole
|
||||
//{
|
||||
// RoleName = command.Name,
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using GozareshgirProgramManager.Application._Common.Models;
|
||||
using GozareshgirProgramManager.Application.Modules.Roles.Commands.CreateRole;
|
||||
using GozareshgirProgramManager.Application.Modules.Roles.Commands.EditRole;
|
||||
using MediatR;
|
||||
using Shared.Contracts.PmRole.Commands;
|
||||
|
||||
@@ -25,4 +26,16 @@ public class PmRoleCommandService: IPmRoleCommandService
|
||||
var res = await _mediator.Send(request);
|
||||
return (res.IsSuccess, res.ErrorMessage);
|
||||
}
|
||||
|
||||
public async Task<(bool, string)> Edit(CreatePmRoleDto command)
|
||||
{
|
||||
var request = new EditRoleCommand
|
||||
{
|
||||
RoleName = command.RoleName,
|
||||
Permissions = command.Permissions,
|
||||
GozareshgirRoleId = command.GozareshgirRoleId
|
||||
};
|
||||
var res = await _mediator.Send(request);
|
||||
return (res.IsSuccess, res.ErrorMessage);
|
||||
}
|
||||
}
|
||||
@@ -3,4 +3,5 @@
|
||||
public interface IPmRoleCommandService
|
||||
{
|
||||
Task<(bool, string)> Create(CreatePmRoleDto command);
|
||||
Task<(bool, string)> Edit(CreatePmRoleDto command);
|
||||
}
|
||||
Reference in New Issue
Block a user