Exemplo n.º 1
0
        public HttpResponseMessage DeleteMonthlyStats(int statID)
        {
            var deletedMonthlyStat = MonthlyStatsServices.DeleteMonthlyStat(statID);

            var response = Request.CreateResponse(HttpStatusCode.OK, deletedMonthlyStat, Configuration.Formatters.JsonFormatter);

            response.Headers.Add("API-Version", apiVersion);
            response.Headers.Add("Response-Type", "JSON");

            if (deletedMonthlyStat == null)
            {
                var notFoundResponse = Request.CreateResponse(HttpStatusCode.NotFound, "(404) Monthly Stats not found",
                                                              Configuration.Formatters.JsonFormatter);

                notFoundResponse.Headers.Add("API-Version", apiVersion);

                return(notFoundResponse);
            }
            else
            {
                return(response);
            }
        }