public Bloco CarregarBloco(Guid BlocoId) { Bloco ret = null; try { using (IDataContextAsync context = new PCFTIDataContext()) using (IUnitOfWorkAsync unitOfWork = new UnitOfWork(context)) { IRepositoryAsync <Bloco> blocoRepository = new Repository <Bloco>(context, unitOfWork); IBlocoService blocoService = new BlocoService(blocoRepository); ret = blocoService.Find(BlocoId); unitOfWork.Dispose(); } } catch { ret = null; } return(ret); }
public bool ExisteBloco(Guid BlocoId) { bool ret = false; try { using (IDataContextAsync context = new PCFTIDataContext()) using (IUnitOfWorkAsync unitOfWork = new UnitOfWork(context)) { IRepositoryAsync <Bloco> blocoRepository = new Repository <Bloco>(context, unitOfWork); IBlocoService blocoService = new BlocoService(blocoRepository); ret = (!(blocoService.Find(BlocoId) == null)); unitOfWork.Dispose(); } } catch { ret = false; } return(ret); }