public HttpResponseMessage UpdateParticipant(HttpRequestMessage request, [FromBody] SCDParticipant participantModel)
        {
            return(GetHttpResponse(request, () =>
            {
                var participant = _ScorecardService.UpdateSCDParticipant(participantModel);

                return request.CreateResponse <SCDParticipant>(HttpStatusCode.OK, participant);
            }));
        }
        public HttpResponseMessage GetParticipant(HttpRequestMessage request, int participantId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                SCDParticipant participant = _ScorecardService.GetSCDParticipant(participantId);

                // notice no need to create a seperate model object since Participant entity will do just fine
                response = request.CreateResponse <SCDParticipant>(HttpStatusCode.OK, participant);

                return response;
            }));
        }
        public HttpResponseMessage DeleteParticipant(HttpRequestMessage request, [FromBody] int participantId)
        {
            return(GetHttpResponse(request, () =>
            {
                HttpResponseMessage response = null;

                // not that calling the WCF service here will authenticate access to the data
                SCDParticipant participant = _ScorecardService.GetSCDParticipant(participantId);

                if (participant != null)
                {
                    _ScorecardService.DeleteSCDParticipant(participantId);

                    response = request.CreateResponse(HttpStatusCode.OK);
                }
                else
                {
                    response = request.CreateErrorResponse(HttpStatusCode.NotFound, "No participant found under that ID.");
                }

                return response;
            }));
        }
Example #4
0
 public SCDParticipant UpdateSCDParticipant(SCDParticipant scdParticipant)
 {
     return(Channel.UpdateSCDParticipant(scdParticipant));
 }