public IActionResult Insights() { var insights = _insightRepository.GetAll(); InsightsViewModel model = new InsightsViewModel() { Insights = insights }; return(View(model)); }
public async Task <IActionResult> Index() { if (!_securityService.CurrrentUserHasAccessToOrganization(CurrentOrganizationId(), AccessLevel.Read)) { return(Forbid()); } var model = new InsightsViewModel(); model.Applications = await _applicationService.GetAllApplicationsForOrganization(CurrentOrganizationId()); model.Sectors = await _sectorService.GetAll(); return(View(model)); }
public IActionResult RenderMain() { user = _db.Users.FirstOrDefault(u => u.UserName == User.Identity.Name); var returnView = new InsightsViewModel(); returnView.RequiredCalories = GetMaintainCalories(user); returnView.currentDailyCalories = GetCurrentUserCalorieCount(user); returnView.userWorkouts = _db.Workouts .Where(w => w.UserId == user.Id) .Select(w => new InsightWorkoutsViewModel() { Name = w.Name, ExerciseCount = w.Exercises.Count }).ToList(); return(View("GeneralPage", returnView)); }
public InsightsPage() { this.InitializeComponent(); this.ViewModel = new InsightsViewModel(); hasGapDetection = !(string.IsNullOrEmpty(SettingsHelper.Instance.DetectionDelay) || string.IsNullOrEmpty(SettingsHelper.Instance.ShelfCamera)); if (hasGapDetection) { gapListener = new GapListenerHub(int.Parse(SettingsHelper.Instance.DetectionDelay), SettingsHelper.Instance.ShelfCamera); } try { this.UpdateCharts(); } catch (Exception e) { Debug.WriteLine(e.ToString()); } }
public IActionResult Insights(InsightsViewModel model) { var insights = _insightRepository.GetAll(); model.Insights = insights; if (model.Client == null || model.Text == null || model.Date == null) { ModelState.AddModelError(String.Empty, "Niet correct ingevuld!"); return(View(model)); } var insight = new Insight() { Client = model.Client, Text = model.Text, Date = model.Date//DateTime.Now }; _insightRepository.Add(insight); return(RedirectToAction("Insights")); }
public InsightsViewModel GetApplicationsGroupedByNationalComponents(int currentOrganizationId) { var models = _context.Application.Where(a => a.OrganizationId == currentOrganizationId) .SelectMany(a => a.ApplicationNationalComponent) .GroupBy(anc => anc.NationalComponentId) .Select(g => new { Name = g.First().NationalComponent.Name, Applications = g.Select(m => new ApplicationListDetailViewModel { AnnualFee = m.Application.DecimalToString(m.Application.AnnualFee), Id = m.Application.Id, Name = m.Application.Name, SystemOwner = m.Application.SystemOwner.FullName, Vendor = m.Application.Vendor.Name, Version = m.Application.Version }) }); InsightsViewModel viewModel = new InsightsViewModel(); Dictionary <string, IEnumerable <ApplicationListDetailViewModel> > nationalComponentsWithApplications = new Dictionary <string, IEnumerable <ApplicationListDetailViewModel> >(); foreach (var model in models) { nationalComponentsWithApplications.Add( model.Name, model.Applications ); } viewModel.ApplicationsForNationalComponent = nationalComponentsWithApplications; return(viewModel); }