public JsonResult SaveStudentDetail(StudentServiceReference.Student student)
        {
            bool   status  = false;
            string message = string.Empty;

            StudentServiceReference.Student studentObj = null;
            StudentServiceReference.StudentServiceClient studentService = new StudentServiceReference.StudentServiceClient();
            studentObj = studentService.SaveStudentDetail(student.StudentID, student);

            return(Json(new { resultData = studentObj, outcome = status, message = message }, JsonRequestBehavior.AllowGet));
        }
        public JsonResult GetStudentDetail(int id)
        {
            bool   status  = false;
            string message = string.Empty;

            StudentServiceReference.Student studentObj = null;
            StudentServiceReference.StudentServiceClient studentService = new StudentServiceReference.StudentServiceClient();
            if (id > 0)
            {
                studentObj = studentService.GetStudentDetail(id);
            }
            return(Json(new { resultData = studentObj, outcome = status, message = message }, JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 3
0
        public bool EditStudent(Student newStudent)
        {
            var student = new StudentServiceReference.Student()
            {
                ID      = newStudent.ID,
                Name    = newStudent.Name,
                Age     = newStudent.Age,
                Sex     = newStudent.Sex,
                Phone   = newStudent.Phone,
                Email   = newStudent.Email,
                ClassID = newStudent.ClassID,
            };

            return(client.editStudent(student.ID.ToString(), student));
        }
Ejemplo n.º 4
0
        public bool CreateStudent(Student newStudent)
        {
            var student = new StudentServiceReference.Student()
            {
                ID      = newStudent.ID,
                Name    = newStudent.Name,
                Age     = newStudent.Age,
                Sex     = newStudent.Sex,
                Phone   = newStudent.Phone,
                Email   = newStudent.Email,
                ClassID = newStudent.ClassID,
            };

            return(client.createStudent(student));
        }
        public JsonResult UpdateStudentDetail(StudentServiceReference.Student student)
        {
            bool   status  = false;
            string message = string.Empty;

            StudentServiceReference.Student         studentObj = null;
            IList <StudentServiceReference.Student> lstStudent = null;

            StudentServiceReference.StudentServiceClient studentService = new StudentServiceReference.StudentServiceClient();
            studentObj = studentService.SaveStudentDetail(student.StudentID, student);
            if (studentObj != null && studentObj.StudentID > 0)
            {
                lstStudent = studentService.GetAllStudentDetail();
            }
            return(Json(new { resultData = lstStudent, outcome = status, message = message }, JsonRequestBehavior.AllowGet));
        }