public ActionResult GetUserCompanies() { return(ActionResultHelper.TryCatchWithLogger(() => { if (Session["idCompany"] != null) { return Json(UserCompaniesConfiguration.GetCachedAvailableCompanies(), JsonRequestBehavior.AllowGet); } return Json(null, JsonRequestBehavior.AllowGet); }, _loggerService)); }
private void SetCustomerCompaniesToSession(string userName) { string idCustomer = CustomerService.GetCustomerIdByUsername(userName); UserCompaniesConfiguration displayCompanies = UserCompaniesConfiguration.GetUserAvailableCompanies(); BindingList <Company> getCompanies = displayCompanies.AvailableCompanies(idCustomer); CustomerCompanyViewModel customerCompanyViewModel = new CustomerCompanyViewModel() { SelectedIndex = 0, CompanyId = (getCompanies != null && getCompanies.Count > 0) ? getCompanies.First().IdCompany : Guid.Empty }; Session["idCompany"] = customerCompanyViewModel; }