public Status CarregarStatus(Guid StatusId) { Status ret = null; try { using (IDataContextAsync context = new PCFTIDataContext()) using (IUnitOfWorkAsync unitOfWork = new UnitOfWork(context)) { IRepositoryAsync <Status> statusRepository = new Repository <Status>(context, unitOfWork); IStatusService statusService = new StatusService(statusRepository); ret = statusService.Find(StatusId); unitOfWork.Dispose(); } } catch { ret = null; } return(ret); }
public bool ExisteStatus(Guid StatusId) { bool ret = false; try { using (IDataContextAsync context = new PCFTIDataContext()) using (IUnitOfWorkAsync unitOfWork = new UnitOfWork(context)) { IRepositoryAsync <Status> statusRepository = new Repository <Status>(context, unitOfWork); IStatusService statusService = new StatusService(statusRepository); ret = (!(statusService.Find(StatusId) == null)); unitOfWork.Dispose(); } } catch { ret = false; } return(ret); }