private async Task ListarArquivosAsync(Arquivo diretorio) { SinalizarDiretorioCorrente(diretorio); IEnumerable <Arquivo> arquivosNoDiretorio = await _arquivoRepository.FindWhereParentEqualsAsync(diretorio.IdArquivo); MontarTabela(arquivosNoDiretorio); }
public async static Task DeleteAsync(long id) { IArquivoRepository arquivoRepository = ArquivoRepositoryFactory.Create(); if (!(await arquivoRepository.FindWhereParentEqualsAsync(id)).Any()) { IFileManager fileManager = FileManagerFactory.Create(); await fileManager.DeleteAsync(await arquivoRepository.FindByIdAsync(id)); await arquivoRepository.DeleteAsync(id); } else { throw new ArgumentException("Diretório não pode ser excluído pois possui dependentes"); } }
protected async void Page_Load(object sender, EventArgs e) { long?idParent = !String.IsNullOrWhiteSpace(Request.Params["fkParent"]) ? Convert.ToInt64(Request.Params["fkParent"]) : (long?)null; IArquivoRepository arquivoRepository = ArquivoRepositoryFactory.Create(); IEnumerable <Arquivo> arquivos = await arquivoRepository.FindWhereParentEqualsAsync(idParent); Response.Clear(); Response.Write(new JavaScriptSerializer().Serialize(new { result = arquivos })); Response.End(); }