示例#1
0
        protected void Page_Load(object sender, EventArgs e)
        {
            if (IsPostBack)
            {
                ListStudents rsvp = new ListStudents(surname.Text, name.Text,
                                                     middlename.Text, lesson.Text, email.Text, phone.Text, achieve.Text);

                StudentsRepository.GetRepository().AddResponse(rsvp);


                try
                {
                    SampleContext context = new SampleContext();
                    context.ListStudent.Add(rsvp);
                    context.SaveChanges();
                    MessageBox.Show("Данные успешно добавлены");
                }
                catch (Exception ex)
                {
                    Response.Redirect("Ошибка " + ex.Message);
                }
            }
        }
示例#2
0
 public void AddResponse(ListStudents response)
 {
     responses.Add(response);
 }