/// <summary> /// 转换为权限实体 /// </summary> /// <param name="dto">权限数据传输对象</param> public static Permission ToEntity(this PermissionDto dto) { if (dto == null) { return(new Permission()); } return(dto.MapTo(new Permission(dto.Id.ToGuid()))); }
public async Task <bool> EditAsync(PermissionDto model) { if (model == null) { return(false); } var entity = model.MapTo <PermissionInfo>(); return(permssionManage.EditTo(entity) ? await context.SaveChangesAsync() > 0 : false); }
private bool SetPermission(PermissionDto dto) { CheckPermission(dto);//检查用户输入 if (dto.Id != Guid.Empty) { PermissionDto dbDto = Dbc.Db.GetById <PermissionDto>(dto.Id); ExHelper.ThrowIfNull(dbDto, "查找更新记录失败."); dbDto.MapTo(dto, a => a.Id); } Dbc.Db.Set(dto); return(true); }
public async Task AddOrUpdate(PermissionDto permission) { await permissionRepository.InsertOrUpdateAsync(permission.MapTo<PermissionInfo>()); }
public async Task AddOrUpdate(PermissionDto permission) { await permissionRepository.InsertOrUpdateAsync(permission.MapTo <PermissionInfo>()); }