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); }
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); }