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