Пример #1
0
        private void submitBtn_Click(object sender, EventArgs e)
        {
            Student          studentModel  = new Student();
            StudentViewModel model         = new StudentViewModel();
            List <string>    coursesIdList = new List <string>();

            File.Copy(filePath.Text, Path.Combine(@"E:\Projects\Internship\Web API's\WebAPI\StudentDesktopApp\Images\", Path.GetFileName(filePath.Text)));

            studentModel.Name            = nameTxt.Text;
            studentModel.Email           = emailTxt.Text;
            studentModel.Password        = passwordTxt.Text;
            studentModel.ConfirmPassword = confirmPasswordTxt.Text;
            studentModel.PhoneNo         = Convert.ToInt32(phoneNoTxt.Text);
            studentModel.ImagePath       = fileName.Text;
            model.Student = studentModel;

            foreach (var selected_courses in coursesList.SelectedItems)
            {
                var courseProperty = (Course)selected_courses;
                coursesIdList.Add(courseProperty.CourseId.ToString());
            }

            model.Courses = coursesIdList;
            _student.Add(studentModel);
            _student.AddStudentCourse(model);
            this.Close();
            StudentListing studentListing = new StudentListing();

            studentListing.Show();
        }
Пример #2
0
        private void loginBtn_Click(object sender, EventArgs e)
        {
            string username = usernameTxt.Text;
            string password = passwordTxt.Text;

            if (_user.ValidateUser(username, password) != null)
            {
                StudentListing student_listing = new StudentListing();
                this.Hide();
                student_listing.Show();
            }
        }