public async Task <IActionResult> IndexAsync()
        {
            List <TableHistoryOfAppointments> historyofappointments = new List <TableHistoryOfAppointments>();
            List <ReserveOfPersonnel>         reserve = new List <ReserveOfPersonnel>();
            var organizations = await _context.TableOrganizations
                                .Include(i => i.users)
                                .ToListAsync();

            if (User.IsInRole("user"))
            {
                int TableOrganizations = _context.TableOrganizations.Include(i => i.users).FirstOrDefault
                                             (i => User.Identity.Name == i.users.UserName).TableOrganizationsId;

                historyofappointments = await _context.TableHistoryOfAppointments
                                        .Include(p => p.Position)
                                        .Include(p => p.EmployeeRegistrationLog)
                                        .Include(p => p.EmployeeRegistrationLog.Worker)
                                        .Include(p => p.Position.Position)
                                        .Where(p => p.EmployeeRegistrationLog.TableOrganizationsId == TableOrganizations && p.DateOfDismissal == null).ToListAsync();

                reserve = await _context.reserveOfPersonnels
                          .Include(i => i.employeeRegistrationLog)
                          .Where(i => i.employeeRegistrationLog.TableOrganizationsId == TableOrganizations).ToListAsync();
            }

            AdminWindowsViewModel model = new AdminWindowsViewModel
            {
                tableOrganizations    = organizations,
                historyOfAppointments = historyofappointments,
                reserveOfPersonnels   = reserve,
            };

            return(View(model));
        }
 public IActionResult Delete(int?id)
 {
     if (id != null)
     {
         AdminWindowsViewModel model = new AdminWindowsViewModel
         {
             OrganizationId = id,
         };
         if (model != null)
         {
             return(View(model));
         }
     }
     return(NotFound());
 }