public async Task LoadSession() { if (CacheProvider.IsSet(CacheKey.LoggedConsultant)) { consultant = CacheProvider.Get <Consultant> (CacheKey.LoggedConsultant); return; } ConsultantSession conSession = SessionFactory.ReadSession <ConsultantSession>(SessionKeys.LoggedConsultant); // may consultant session na, so kunin nalang natin ung info nya. if (conSession != null && conSession.IsSet) { consultant = await conService.GetConsultantByUsername(conSession.Username); } // i-load muna ung consultant session from account session ConsultantSessionLoader conLoader = new ConsultantSessionLoader(conService); bool isLoaded = await conLoader.LoadConsultantSession(); if (isLoaded) { consultant = conLoader.LoadedConsultant; CacheProvider.Set(CacheKey.LoggedConsultant, consultant); } }
public async Task LoadSession() { ConsultantSession conSession = SessionFactory.ReadSession <ConsultantSession>(SessionKeys.LoggedConsultant); // may consultant session na, so kunin nalang natin ung info nya. if (conSession != null && conSession.IsSet) { consultant = await conService.GetConsultantByUsername(conSession.Username); } // i-load muna ung consultant session from account session ConsultantSessionLoader conLoader = new ConsultantSessionLoader(conService); bool isLoaded = await conLoader.LoadConsultantSession(); if (isLoaded) { consultant = conLoader.LoadedConsultant; } // pag may laman, may na-load kaya != // return consultant != null; }