DD.WellWorkover.Cloud/AsbCloudWebApi/Controllers/AdminUserRoleController.cs

36 lines
998 B
C#
Raw Normal View History

using AsbCloudApp.Data;
2021-09-10 11:28:57 +05:00
using AsbCloudApp.Services;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using System.Threading.Tasks;
2021-09-10 11:28:57 +05:00
namespace AsbCloudWebApi.Controllers
{
2021-12-03 09:44:10 +05:00
[Route("api/admin/role")]
2021-09-10 11:28:57 +05:00
[ApiController]
[Authorize]
2022-04-11 18:00:34 +05:00
public class AdminUserRoleController : CrudController<UserRoleDto, IUserRoleService>
2021-09-10 11:28:57 +05:00
{
public AdminUserRoleController(IUserRoleService service)
2022-04-11 18:00:34 +05:00
: base(service)
{
InsertForbidAsync = (role, token) =>
{
return Task.FromResult(role?.IdType == 1);
};
UpdateForbidAsync = async ( dto, token) =>
{
var role = await service.GetAsync(dto.Id, token);
return role?.IdType == 1;
};
DeleteForbidAsync = async (id, token) =>
{
var role = await service.GetAsync(id, token);
return role?.IdType == 1;
};
}
2021-09-10 11:28:57 +05:00
}
}