コード例 #1
0
        public HttpResponseMessage Delete(int degreeId)
        {
            try
            {
                var deleteDegreeCommand = new DeleteDegree(User, degreeId);
                _deleteDegree.Handle(deleteDegreeCommand);
            }
            catch (Exception ex)
            {
                var responseMessage = new HttpResponseMessage
                {
                    StatusCode = HttpStatusCode.NotModified,
                    Content = new StringContent(ex.Message),
                    ReasonPhrase = "Degree delete error"
                };
                throw new HttpResponseException(responseMessage);
            }

            return Request.CreateResponse(HttpStatusCode.OK);
        }
コード例 #2
0
 public HttpResponseMessage Delete(int personId, int degreeId)
 {
     var command = new DeleteDegree(User, degreeId, personId);
     _deleteHandler.Handle(command);
     return Request.CreateResponse(HttpStatusCode.OK, "Degree was successfully deleted.");
 }