Пример #1
0
 /// <summary>
 ///  删除
 /// </summary>
 /// <param name="id"></param>
 /// <returns></returns>
 public async Task RemoveRmpOrRole(Guid id)
 {
     using IEmployeesOrRoleService employeesOrRoleService = new EmployeesOrRoleService();
     if (await employeesOrRoleService.GetAllAsync().AnyAsync(i => i.Id == id))
     {
         var employeeOrRole = employeesOrRoleService.GetAllAsync().FirstOrDefault(i => i.Id == id);
         if (employeeOrRole != null)
         {
             await employeesOrRoleService.RemoveAsync(id);
         }
     }
 }
Пример #2
0
 /// <summary>
 ///  修改
 /// </summary>
 /// <param name="id"></param>
 /// <param name="userId"></param>
 /// <param name="roleId"></param>
 /// <returns></returns>
 public async Task EditEmpOrRole(Guid id, Guid userId, Guid roleId)
 {
     using IEmployeesOrRoleService employeesOrRoleService = new EmployeesOrRoleService();
     if (await employeesOrRoleService.GetAllAsync().AnyAsync(i => i.Id == id))
     {
         var employeeOrRole = employeesOrRoleService.GetAllAsync().FirstOrDefault(i => i.Id == id);
         if (employeeOrRole != null)
         {
             employeeOrRole.UserId = userId;
             employeeOrRole.RoleId = roleId;
         }
         await employeesOrRoleService.EditAsync(employeeOrRole);
     }
 }
Пример #3
0
 public async Task <List <EmployeeOrRoleDto> > GetAllEmployeesOrRole()
 {
     using IEmployeesOrRoleService employeesOrRoleService = new EmployeesOrRoleService();
     return(await employeesOrRoleService.GetAllAsync().Select(i => new EmployeeOrRoleDto()
     {
         Id = i.Id,
         EmployeesId = i.UserId,
         RoleId = i.RoleId
     }).ToListAsync());
 }