示例#1
0
 public TeacherListViewModel(IDialogService dialogService, ITeacherService teacherService) : base(dialogService)
 {
     TeacherService             = teacherService;
     TeacherEvaluationViewModel = new TeacherEvaluationViewModel(dialogService, teacherService);
     TeacherDetailsViewModel    = new TeacherDetailsViewModel(dialogService, teacherService);
     TArgs = new TeacherDetailsArgs();
     EArgs = new TeacherEvaluationArgs();
 }
        public async Task LoadAsync(TeacherEvaluationArgs args)
        {
            ViewModelArgs = args ?? TeacherEvaluationArgs.CreateDefault();
            try
            {
                if (String.IsNullOrWhiteSpace(ViewModelArgs.StudentId) || String.IsNullOrWhiteSpace(ViewModelArgs.TeacherId))
                {
                    Item = null;
                }
                else
                {
                    var item = await TeacherService.GetTeacherEvaluationAsync(ViewModelArgs.TeacherId, ViewModelArgs.StudentId);

                    Item = item ?? new TeacherEvaluationModel {
                        StudentId = ViewModelArgs.StudentId, TeacherId = ViewModelArgs.TeacherId, IsEmpty = true
                    };
                }
            }
            catch (Exception ex)
            {
                await DialogService.ShowAsync("载入失败", ex.Message);
            }
        }