private void button1_Click(object sender, EventArgs e) { string courseName = txtCourse.Text; string numberOfYear = txtNumberOfYear.Text; string status = txtStatus.Text; Course course = new Course(); course.setCourseName(courseName); course.setNumberOfYear(numberOfYear); course.setStatus(status); CourseController courseController = new CourseController(); bool i = courseController.AddCourse(course); if (i == true) { MessageBox.Show("Course Added Successfully"); txtCourse.Text = ""; txtNumberOfYear.Text = ""; txtStatus.Text = ""; } else { MessageBox.Show("Course is not added"); } }
public override Task <Empty> AddCourse(CourseReply request, ServerCallContext context) { Course course = new Course { CourseID = request.CourseID, CourseName = request.CourseName }; logic.AddCourse(course); return(Task.FromResult(new Empty())); }
private void addteacherBtn(object sender, EventArgs e) { string name = crsnametextBox.Text; string code = crscodetextBox.Text; string teacher = crsteachertextBox.Text; bool x = CourseController.AddCourse(name, code, teacher); if (x) { MessageBox.Show("Course Added !"); } else { MessageBox.Show("Course Not Added"); } }
private void buttonAdd_Click(object sender, EventArgs e) { try { Course c = new Course(); c.courseName = textBoxCourseName.Text; c.cId = Int32.Parse(textBoxClassId.Text); bool b = CourseController.AddCourse(c); if (b) { MessageBox.Show("Section Added"); } else { MessageBox.Show("Failed"); } } catch (Exception) { MessageBox.Show("Invalid input"); } }