public TipoBloco CarregarTipoBloco(Guid TipoBlocoId) { TipoBloco ret = null; try { using (IDataContextAsync context = new PCFTIDataContext()) using (IUnitOfWorkAsync unitOfWork = new UnitOfWork(context)) { IRepositoryAsync <TipoBloco> tipoblocoRepository = new Repository <TipoBloco>(context, unitOfWork); ITipoBlocoService tipoblocoService = new TipoBlocoService(tipoblocoRepository); ret = tipoblocoService.Find(TipoBlocoId); unitOfWork.Dispose(); } } catch { ret = null; } return(ret); }
public bool ExisteTipoBloco(Guid TipoBlocoId) { bool ret = false; try { using (IDataContextAsync context = new PCFTIDataContext()) using (IUnitOfWorkAsync unitOfWork = new UnitOfWork(context)) { IRepositoryAsync <TipoBloco> tipoblocoRepository = new Repository <TipoBloco>(context, unitOfWork); ITipoBlocoService tipoblocoService = new TipoBlocoService(tipoblocoRepository); ret = (!(tipoblocoService.Find(TipoBlocoId) == null)); unitOfWork.Dispose(); } } catch { ret = false; } return(ret); }