public ActionResult Index(AccountValueListModel model) { model.SOBId = SessionHelper.SOBId; model.Segments = AccountHelper.GetSegmentList(model.SOBId.ToString()); if (model.Segments.Any(x => x.Value == SessionHelper.SelectedValue)) { model.Segment = SessionHelper.SelectedValue; } else { model.Segment = model.Segments[0].Value; SessionHelper.SelectedValue = model.Segment; } return(View(model)); }
public ActionResult Index(AccountValueListModel model) { if (model.SetOfBooks == null) { model.SetOfBooks = sobService.GetByCompanyId(AuthenticationHelper.User.CompanyId) .Select(x => new SelectListItem { Text = x.Name, Value = x.Id.ToString() }).ToList(); } if (model.Segments == null && model.SetOfBooks.Any()) { model.Segments = getSegmentList(model.SetOfBooks.First().Value.ToString()); } model.AccountValues = service.GetAll(AuthenticationHelper.User.CompanyId).Select(x => new AccountValueViewModel(x)).ToList(); return(View(model)); }