Esempio n. 1
0
        public IHttpActionResult CreateOrder(string token, int userId, Order order)
        {
            if (!ModelState.IsValid || !ApplicationHelper.IsTokenValid(token, userId))
            {
                return(Content(HttpStatusCode.BadRequest, "BadRequest"));
            }

            var result = OrdersLogic.CreateOrder(order);

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

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