Could not help with the code or share a useful link on this issue. The task is the following, in my main table where the data lie there is a column "Branch". In this column there are 25 names for each of the names, I will create (l) 25 links where the user will have a choice. The catch is that for each link, I'm going to assign access to a specific group from ActiveDirectory. I can create another 24 of the same controllers and carry out my plans, but this will not be correct.
My controller is next
[HttpGet] public ActionResult TestNew(string branchname) { // check stuff like permissions var db = new MovieContext(); var model = new Model(); var students = db.Student .Where(x => x.BranchName == branchname) .GroupBy(x => new { x.BranchName, x.Name, x.Currency, x.NoCart, x.NoAccount }) .Select(x => new { BranchName = x.FirstOrDefault().BranchName, Name = x.FirstOrDefault().Name, A_Status = x.Max(p => p.A_Status), Currency = x.FirstOrDefault().Currency, NoCart = x.FirstOrDefault().NoCart, NoAccount = x.FirstOrDefault().NoAccount }).ToList(); foreach (var item in students) { model.Students.Add(new Student { A_Status = item.A_Status, BranchName = item.BranchName, Name = item.Name, NoAccount = item.NoAccount, NoCart = item.NoCart, Currency = item.Currency }); } return View(model);