Ejemplo n.º 1
0
        // GET /api/students/id
        public IHttpActionResult GetStudent(int id)
        {
            if (id == 0)
            {
                return(NotFound());
            }

            studentsService = new StudentsService();

            Student student = studentsService.GetStudent(id);

            if (student == null)
            {
                return(NotFound());
            }

            studentToExposeService = new StudentToExposeService();

            StudentToExpose studentToExpose = studentToExposeService.TrimStudent(student);

            return(Ok(studentToExpose));
        }
 private void searchBtn_Click(object sender, EventArgs e)
 {
     if (RollNoTb.Text != "")
     {
         _student.Id = int.Parse(RollNoTb.Text);
         var student = _studentService.GetStudent(_student);
         NameTb.Text          = student.Name;
         FatherNameTb.Text    = student.FatherName;
         GenderTb.Text        = student.Gender;
         PhoneTb.Text         = student.Phone;
         AddressTb.Text       = student.Address;
         SessionTb.Text       = student.Session;
         AdminDateValue.Value = student.AdminDate;
         ClassTb.Text         = student.Class;
         EmailTb.Text         = student.Email;
         DOBvalue.Value       = student.Dob;
     }
     else
     {
         MessageBox.Show("Please Enter a RollNo!", "RollNo. is not provided", MessageBoxButtons.OK, MessageBoxIcon.Warning);
     }
 }