using AsbCloudApp.Data.User; using AsbCloudApp.Repositories; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; using System.Threading.Tasks; namespace AsbCloudWebApi.Controllers { /// /// Редактор ролей пользователей для админки /// [Route("api/admin/role")] [ApiController] [Authorize] public class AdminUserRoleController : CrudController { public AdminUserRoleController(IUserRoleRepository service) : base(service) { UpdateForbidAsync = async (dto, token) => { var role = await service.GetOrDefaultAsync(dto.Id, token); return role?.Id == 1; }; DeleteForbidAsync = (id, token) => { return Task.FromResult(id == 1); }; } } }