Exemplo n.º 1
0
        public HttpResponseMessage GetAllSubjects(HttpRequestMessage request, int requirementId)
        {
            var subjects = _studentApi.GetSubjects(requirementId);

            var subjectVm = SubjectViewModel.MapMultipleSubjects(subjects);

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

            return(response);
        }
Exemplo n.º 2
0
        public HttpResponseMessage AddSubjects(HttpRequestMessage request, List <Subject> subjects)
        {
            var mappedSubjects  = SubjectViewModel.MapMultipleSubjects(subjects);
            var studentSubjects = new List <Subject>();

            foreach (var modelSubject in mappedSubjects)
            {
                studentSubjects.Add(modelSubject.ReverseMap());
            }

            _studentApi.AddSubjects(studentSubjects);

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

            return(response);
        }