private ChannelEntity toEntity(ChannelTableEntity tableEntity) { ChannelEntity entity = new ChannelEntity(); entity.WorkspaceID = tableEntity.PartitionKey; entity.ChannelId = tableEntity.RowKey; if (!string.IsNullOrWhiteSpace(tableEntity.Name)) { entity.Name = tableEntity.Name; } if (!string.IsNullOrWhiteSpace(tableEntity.Owner)) { entity.Owner = tableEntity.Owner; } if (!string.IsNullOrWhiteSpace(tableEntity.Picture_Location)) { entity.Picture_Location = tableEntity.Picture_Location; } if (!string.IsNullOrWhiteSpace(tableEntity.Users)) { entity.Users = tableEntity.Users; } return(entity); }
private ChannelTableEntity toTableEntity(ChannelEntity entity) { ChannelTableEntity tableEntity = new ChannelTableEntity(entity.WorkspaceID, entity.ChannelId); if (!string.IsNullOrWhiteSpace(entity.Name)) { tableEntity.Name = entity.Name; } if (!string.IsNullOrWhiteSpace(entity.Owner)) { tableEntity.Owner = entity.Owner; } if (!string.IsNullOrWhiteSpace(entity.Picture_Location)) { tableEntity.Picture_Location = entity.Picture_Location; } if (!string.IsNullOrWhiteSpace(entity.Users)) { tableEntity.Users = entity.Users; } return(tableEntity); }
public async Task <ChannelEntity> Get(string[] key, string[] value) { return(await Task <ChannelEntity> .Run(() => { ChannelTableEntity channelTableEntity = this.cloudTable.Get(key, value).Result; return this.toEntity(channelTableEntity); })); }
public async Task <bool> Delete(ChannelEntity entity) { ChannelTableEntity channelTableEntity = this.toTableEntity(entity); return(await this.cloudTable.Delete(channelTableEntity)); }