Example #1
0
        public IHttpActionResult DeleteOrder(string token, int userId, int id)
        {
            if (!ApplicationHelper.IsTokenValid(token, userId))
            {
                return(Content(HttpStatusCode.BadRequest, "BadRequest"));
            }

            var order = OrdersLogic.GetOrder(id);

            if (order == null)
            {
                return(Content(HttpStatusCode.NotFound, "NotFound"));
            }

            var result = OrdersLogic.DeleteOrder(id);

            if (!result.Success)
            {
                ApplicationHelper.Log(result.Message);
            }

            return(result.Success
                ? Content(HttpStatusCode.OK, "OK")
                : Content(HttpStatusCode.InternalServerError, result.Message));
        }