Beispiel #1
0
        public async Task LoadAsync(StudentEvaluationArgs args)
        {
            ViewModelArgs = args ?? StudentEvaluationArgs.CreateDefault();

            try
            {
                if (String.IsNullOrWhiteSpace(ViewModelArgs.StudentId) || String.IsNullOrWhiteSpace(ViewModelArgs.TeacherId))
                {
                    Item       = null;
                    IsEditMode = false;
                }
                else
                {
                    var item = await StudentEvaluationService.GetStudentEvaluationAsync(ViewModelArgs.TeacherId, ViewModelArgs.StudentId);

                    Item = item ?? new StudentEvaluationModel {
                        StudentId = ViewModelArgs.StudentId, TeacherId = ViewModelArgs.TeacherId, IsEmpty = true
                    };
                    if (item == null)
                    {
                        IsEditMode = true;
                    }
                    else
                    {
                        IsEditMode = false;
                    }
                }
            }
            catch (Exception ex)
            {
                await DialogService.ShowAsync("载入失败", ex.Message);
            }
        }
 public StudentListViewModel(IDialogService dialogService, IStudentService studentService, IStudentEvaluationService studentEvaluationService) : base(dialogService)
 {
     StudentService             = studentService;
     StudentDetailsViewModel    = new StudentDetailsViewModel(studentService, dialogService);
     StudentEvaluationViewModel = new StudentEvaluationViewModel(studentEvaluationService, dialogService);
     SArgs = new StudentDetailsArgs();
     EArgs = new StudentEvaluationArgs();
 }