コード例 #1
0
        public HttpResponseMessage MashBatch(int batchId)
        {
            var batchMasher = new BatchMasher();
            var mashMe      = batchMasher.MashBatch(batchId);

            switch (mashMe)
            {
            case UpdateStatusResults.NotFound:
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Batch ID does not exist."));

            case UpdateStatusResults.Unsuccessful:
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "Batch could not be update, please try again."));

            case UpdateStatusResults.ValidationFailure:
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "The batch is not valid, please try again."));

            case UpdateStatusResults.Success:
                return(Request.CreateResponse(HttpStatusCode.OK));

            default:
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Batch could not be updated, please try again."));
            }
        }
コード例 #2
0
        public HttpResponseMessage MashBatch(int batchId)
        {
            var batchMasher = new BatchMasher();
            var mashMe      = batchMasher.MashBatch(batchId);

            switch (mashMe)
            {
            case UpdateStatusResults.NotFound:
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Batch Id does not exist"));

            case UpdateStatusResults.Unsuccessful:
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "I suck"));

            case UpdateStatusResults.Success:
                return(Request.CreateResponse(HttpStatusCode.OK));

            case UpdateStatusResults.ValidationFailure:
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "You suck"));

            default:
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Everything sucks"));
            }
        }
コード例 #3
0
        public HttpResponseMessage MashBatch(int batchId)
        {
            var batchMasher = new BatchMasher();
            var mashIt      = batchMasher.MashBatch(batchId);

            switch (mashIt)
            {
            case UpdateStatusResults.NotFound:
                return(Request.CreateErrorResponse(HttpStatusCode.NotFound, "Batch not found"));

            case UpdateStatusResults.Success:
                return(Request.CreateResponse(HttpStatusCode.OK));

            case UpdateStatusResults.Unsuccessful:
                return(Request.CreateErrorResponse(HttpStatusCode.InternalServerError, "We suk"));

            case UpdateStatusResults.ValidationFailure:
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "U suk"));

            default:
                return(Request.CreateErrorResponse(HttpStatusCode.BadRequest, "Life suks"));
            }
        }