public IHttpActionResult Sync(YearFilterViewModel viewmodel) { if (ModelState.IsValid) { _fundService.SyncFunds(viewmodel.Year.Value, DbSource.ALL); } return(Ok()); }
public ActionResult Index(YearFilterViewModel filter, int page = 1) { var pagingInfo = new PagingInfo() { PageNumber = page }; var entities = Enumerable.Empty <Bar>(); #region keep track of filter across if (filter != null && !filter.IsEmpty) { TempData[FilterDateKey] = filter; } else { if (TempData.Peek(FilterDateKey) != null) { filter = TempData.Peek(FilterDateKey) as YearFilterViewModel; } } #endregion keep track of filter across if (filter.Year.HasValue) { entities = _barService.GetAllBars(!string.IsNullOrEmpty(filter.DateAsYear) ? int.Parse(filter.DateAsYear) : (int?)null , filter.DisplayName, filter.BarNumber, null, filter.DbSource, pagingInfo); ViewBag.DisplayResults = true; } else { ViewBag.DisplayResults = false; } var viewmodel = new BarsListViewModel() { Filters = filter, Data = entities.ToMappedPagedList <Bar, BarDetailsViewModel>(pagingInfo) }; ViewBag.AvailableDbSources = new List <SelectListItem>() { new SelectListItem() { Text = DbSource.GC.ToString(), Value = ((int)DbSource.GC).ToString() }, new SelectListItem() { Text = DbSource.DIST.ToString(), Value = ((int)DbSource.DIST).ToString() } }; ViewBag.DisplayBarNumberTarget = filter.DbSource.HasValue && (filter.DbSource.Value == DbSource.DIST); return(View(viewmodel)); }
public ActionResult Index(YearFilterViewModel filters, int page = 1) { var pagingInfo = new PagingInfo() { PageNumber = page }; var entities = Enumerable.Empty <Fund>(); // keep track of filter across if (filters != null && !filters.IsEmpty) { TempData[FilterDateKey] = filters; } else { if (TempData.Peek(FilterDateKey) != null) { filters = TempData.Peek(FilterDateKey) as YearFilterViewModel; } } if (filters.Year.HasValue) { entities = _fundService.GetAllFunds(filters.Year.Value, filters.DbSource, filters.DisplayName, filters.FundNumber, null, pagingInfo); } var viewmodel = entities.ToMappedPagedList <Fund, FundDetailsViewModel>(pagingInfo); ViewBag.FilterViewModel = filters; ViewBag.AvailableDbSources = new List <SelectListItem>() { new SelectListItem() { Text = DbSource.GC.ToString(), Value = ((int)DbSource.GC).ToString() }, new SelectListItem() { Text = DbSource.DIST.ToString(), Value = ((int)DbSource.DIST).ToString() } }; return(View(viewmodel)); }
// GET: MappingRules public ActionResult Index(YearFilterViewModel filters, int page = 1) { var pagingInfo = new PagingInfo() { PageNumber = page }; var entities = Enumerable.Empty <MappingRule>(); if (TryValidateModel(filters)) { entities = _mappingRuleService.GetAll(filters.Year, filters.FundNumber, pagingInfo); ViewBag.DisplayResults = true; } else { ViewBag.DisplayResults = false; } var viewmodel = entities.ToMappedPagedList <MappingRule, MappingRuleDetailsViewModel>(pagingInfo); ViewBag.FilterViewModel = filters; return(View(viewmodel)); }