コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }