Example #1
0
        private IEntity DataBoard_GetEntityBySelectedView(object sender, EntityTransferEventArgs e)
        {
            var selectedView = e.Entity;

            switch (selectedView)
            {
            case StudentView studentView:
                return(EFGenericRepository.Find <Student>(studentView.Id));

            case GroupView groupView:
                return(EFGenericRepository.Find <Group>(groupView.Id));

            default:
                return(null);
            }
        }
Example #2
0
        private void StudentBoardSecond_SetInitGroup(object sender, EntityTransferEventArgs e)
        {
            if (_studentBoardSecond.GroupsCollection.Count == 0)
            {
                return;
            }
            else
            {
                ((IGroupView)_studentBoardSecond.GroupsCollection[0]).ResetOtherBoard();

                if (e.Entity != null)
                {
                    var group = _studentBoardSecond.GroupsCollection
                                .Cast <IGroupView>()
                                .FirstOrDefault(g => g.Id == e.Entity.Id);

                    group?.SelectView();
                }
            }
        }