Esempio n. 1
0
        public IHttpActionResult SendReport(string token, int userId, int orderId, string email)
        {
            if (!ApplicationHelper.IsTokenValid(token, userId))
            {
                return(Content(HttpStatusCode.BadRequest, "BadRequest"));
            }

            var order = OrdersLogic.GetOrder(orderId);

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

            var result = OrdersLogic.SendReport(order, email);

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

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