Exemplo n.º 1
0
        public async Task <ActionResult> Index()
        {
            string Courses = await courseBL.GetCourses();

            List <Cours> cust = JsonConvert.DeserializeObject <List <Cours> >(Courses);

            return(View(cust));
        }
Exemplo n.º 2
0
 private void ShowCourses_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         if (courseblObj != null)
         {
             courses = courseblObj.GetCourses().Select(item => new SelectedCourse
             {
                 CourseID   = item.CourseID,
                 StartDate  = item.StartDate,
                 EndDate    = item.EndDate,
                 Name       = item.Name,
                 isSelected = false
             }).ToList();
             courseGrid.ItemsSource = courses;
         }
         else
         {
             MessageBox.Show("No Courses Found!");
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Exemplo n.º 3
0
 private void Button_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         CourseBL course = new CourseBL();
         grid.ItemsSource = course.GetCourses();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
 private void LoadCourseComboBox()
 {
     try
     {
         CourseBL courseBL = new CourseBL();
         coursecmbbox.ItemsSource       = courseBL.GetCourses();
         coursecmbbox.SelectedValuePath = "CourseID";
         coursecmbbox.DisplayMemberPath = "Name";
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
     }
 }
Exemplo n.º 5
0
        public async Task <ActionResult> Delete(Cours c)
        {
            CourseBL courseBL = new CourseBL();
            string   userData = JsonConvert.SerializeObject(c.CourseID);
            string   result   = await courseBL.DeleteC(c.CourseID);

            if (result == "true")
            {
                string courses = await courseBL.GetCourses();

                List <Cours> userList = JsonConvert.DeserializeObject <List <Cours> >(courses);
                return(View("Index", userList));
            }
            return(View());
        }