Пример #1
0
        private async void GroupBoard_UpdateView(object sender, EventArgs e)
        {
            groupBoard.DisableCurrentStudentPanel();
            groupBoard.DisableAddedStudentPanel();

            await AddControlsToControlCollection(
                EFGenericRepository.GetEntitiesWithState <Student>(EntityState.Added, s => s.GroupId == null).ToArray(),
                CancellationToken.None);

            //для студентов, которые были загружены с бд и в процессе были исключены из группы
            await AddControlsToControlCollection(
                EFGenericRepository.Get <Student>(s => s.GroupId == null).ToArray(),
                CancellationToken.None);

            await DeleteControlsFromControlCollection(
                EFGenericRepository.GetEntitiesWithState <Student>(EntityState.Deleted, s => s.GroupId == null),
                CancellationToken.None);

            await UpdateControlsFromControlCollection(
                EFGenericRepository.GetEntitiesWithState <Student>(EntityState.Modified).ToArray(),
                CancellationToken.None);

            groupBoard.EnableCurrentStudentPanel();
            groupBoard.EnableAddedStudentPanel();
        }
        private async void EditGroupBoardFirst_UpdateView(object sender, EventArgs e)
        {
            await AddControlsToControlCollection(
                EFGenericRepository.GetEntitiesWithState <Group>(EntityState.Added).ToArray(),
                CancellationToken.None);

            await DeleteControlsFromControlCollection(
                EFGenericRepository.GetEntitiesWithState <Group>(EntityState.Deleted).ToArray(),
                CancellationToken.None);

            await UpdateControlFromControlColletion(
                EFGenericRepository.GetEntitiesWithState <Group>(EntityState.Modified).ToArray(),
                CancellationToken.None);
        }
        private async void EditStudentBoardFirst_UpdateView(object sender, EventArgs e)
        {
            _editStudentBoardFirst.DisablingControlCollection();

            await AddControlsToControlCollection(
                EFGenericRepository.GetEntitiesWithState <Student>(EntityState.Added).ToArray(),
                CancellationToken.None);

            await DeleteControlsFromControlCollection(
                EFGenericRepository.GetEntitiesWithState <Student>(EntityState.Deleted),
                CancellationToken.None);

            await UpdateControlsFromControlCollection(
                EFGenericRepository.GetEntitiesWithState <Student>(EntityState.Modified).ToArray(),
                CancellationToken.None);

            _editStudentBoardFirst.EnablingControlCollection();
        }