コード例 #1
0
        public HttpResponseMessage GetStudent(HttpRequestMessage request, int Id)
        {
            var student = _studentApi.GetStudent(Id);

            StudentViewModel studentVM = new StudentViewModel();

            studentVM.MapSingleStudent(student);

            var response = request.CreateResponse(HttpStatusCode.OK, studentVM);

            return(response);
        }
コード例 #2
0
        public HttpResponseMessage SaveStudent(HttpRequestMessage request, StudentViewModel student)
        {
            var newStudent = student.ReverseMap();

            _studentApi.SaveStudent(newStudent);

            var model = new StudentViewModel();

            var studentVm = model.MapSingleStudent(newStudent);

            var response = request.CreateResponse(HttpStatusCode.Created, studentVm);

            return(response);
        }