public IActionResult Index() { var model = new RegionListViewModel(); var adminRegionService = serviceLocator.GetService <IAdminRegionService>(); model.regions = adminRegionService.GetAll().Result; return(View("Views/Region/RegionListView.cshtml", model)); }
public ActionResult List(int pageIndex = 1) { long?cityId = AdminHelper.GetCityId(this.HttpContext); if (cityId == null) { return(View("~/Views/Shared/Error.cshtml", (object)"总部人员无法管理区域")); } var regions = RegionService.GetAll(cityId.Value); RegionListViewModel regionListView = new RegionListViewModel(); regionListView.Regions = regions; regionListView.CityId = cityId.Value; regionListView.PageIndex = pageIndex; regionListView.PageCount = 10; regionListView.TotalCount = regions.LongCount(); return(View(regionListView)); }
public StartRoundViewModel() { // this.Crumbs.Add(new BreadcrumbItemModel("Home", this.GoHome)); this.Crumbs.Add(new BreadcrumbItemModel("Start Round")); RoundTimes = new List <RoundTimeViewModel>(); Navigate = new AsyncCommand(async(obj) => { //start the new round. StartRound(); var file = ServiceResolver.Resolve <IFileHandler>(); var reads = await file.GetFileAsync(Constants.FileNames.Regions); var vm = new RegionListViewModel(this, reads); Navigator.Navigate(ViewModels.Shared.Navigation.NavigationType.RegionSelect, vm); }); if (RoundManager.CurrentRound != null) { //round already running, so skip this screen and go to the next. this.Navigate.Execute(this); } var currentHour = DateTime.Now.Hour; RoundTimes.Clear(); if (currentHour >= 0 && currentHour <= 4) { // 2 round RoundTimes.Add(new RoundTimeViewModel() { RoundHour = "2:00" }); } else if (currentHour > 4 && currentHour <= 10) { // 8 round RoundTimes.Add(new RoundTimeViewModel() { RoundHour = "8:00" }); } else if (currentHour > 10 && currentHour <= 16) { //14 round RoundTimes.Add(new RoundTimeViewModel() { RoundHour = "14:00" }); } else if (currentHour > 16 && currentHour <= 22) { // 20 round RoundTimes.Add(new RoundTimeViewModel() { RoundHour = "20:00" }); } else if (currentHour == 23) { // 2 round RoundTimes.Add(new RoundTimeViewModel() { RoundHour = "2:00" }); } }