コード例 #1
0
        public Task <string> AddStudentStep1(StudentStep1 addingStudent)
        {
            return(Task.Run(() =>
            {
                try
                {
                    List <StudentStep1> listofstudent = new List <StudentStep1>();
                    if (RefreshStudentStep1().Result != null)
                    {
                        listofstudent = RefreshStudentStep1().Result.ToList();
                    }

                    listofstudent.Add(addingStudent);
                    String json = JsonConvert.SerializeObject(listofstudent);
                    File.WriteAllText(default_path + target_path + @"\tudentstep1.txt", string.Empty);
                    File.WriteAllText(default_path + target_path + @"\tudentstep1.txt", json);
                    //Task<string> result = new Task<string>("success");
                    //string result = "success";
                    return "success";
                }
                catch (Exception ex)
                {
                    MessageBox.Show("can't interpret some values .\n\n" + ex.Message + "\n\n Please check   ", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    return ex.Message;
                }
            }));
        }
コード例 #2
0
 public Task <string> AddStudentStep1(StudentStep1 addingStudent)
 {
     throw new NotImplementedException();
 }