public async Task <ActionResult> SelectCoachAsync(ServingCoachQueryViewModel viewModel) { ViewBag.ViewModel = viewModel; ViewBag.SelectAll = viewModel.SelectAll; ViewBag.Allotment = viewModel.Allotment; ViewBag.AllotmentCoach = viewModel.AllotmentCoach; var profile = await HttpContext.GetUserAsync(); var indicators = models.GetTable <MonthlyCoachRevenueIndicator>(); IQueryable <ServingCoach> items = models.PromptEffectiveCoach() .Where(c => indicators.Any(i => i.CoachID == c.CoachID)); if (profile.IsOfficer() || profile.IsAssistant() || profile.IsSysAdmin()) { } else if (profile.IsManager() || profile.IsViceManager()) { items = profile.GetServingCoachInSameStore(models, items); } else if (profile.IsCoach()) { items = items.Where(c => c.CoachID == profile.UID); } else { items = items.Where(c => false); } return(View("~/Views/ContractConsole/ContractModal/SelectCoach.cshtml", items)); }
public ActionResult SelectCoach(ServingCoachQueryViewModel viewModel) { ViewBag.ViewModel = viewModel; ViewBag.SelectAll = viewModel.SelectAll; ViewBag.Allotment = viewModel.Allotment; ViewBag.AllotmentCoach = viewModel.AllotmentCoach; var profile = HttpContext.GetUser(); IQueryable <ServingCoach> items = models.PromptEffectiveCoach(); if (profile.IsOfficer() || profile.IsAssistant() || profile.IsSysAdmin()) { } else if (profile.IsManager() || profile.IsViceManager()) { items = profile.GetServingCoachInSameStore(models, items); } else if (profile.IsCoach()) { items = items.Where(c => c.CoachID == profile.UID); } else { items = items.Where(c => false); } return(View("~/Views/ContractConsole/ContractModal/SelectCoach.cshtml", items)); }
public ActionResult SelectCoachWithBranch(ServingCoachQueryViewModel viewModel) { ViewBag.ViewModel = viewModel; viewModel.SelectablePartial = "~/Views/LessonConsole/Module/SelectBranch.cshtml"; var items = models.PromptEffectiveCoach(); if (viewModel.WorkPlace.HasValue) { items = items.Where(s => s.CoachWorkplace.Any(w => w.BranchID == viewModel.WorkPlace)); } return(View("~/Views/ContractConsole/ContractModal/SelectCoach.cshtml", items)); }