Example #1
0
        public static HttpResponseMessage InvalidData()
        {
            MyJsonResult json = MyJsonResult.CreateError("Data supplied are invalid.");

            return(new HttpResponseMessage(System.Net.HttpStatusCode.BadRequest)
            {
                Content = new JsonContent(json)
            });
        }
Example #2
0
        public static HttpResponseMessage NotImplemented()
        {
            MyJsonResult json = MyJsonResult.CreateError(RQResources.Views.Shared.SharedStrings.err_notimplemented);

            return(new HttpResponseMessage(System.Net.HttpStatusCode.NotImplemented)
            {
                Content = new JsonContent(json)
            });
        }
Example #3
0
        public static HttpResponseMessage UnknownError()
        {
            MyJsonResult json = MyJsonResult.CreateError(RQResources.Views.Shared.SharedStrings.err_unknown);

            return(new HttpResponseMessage(System.Net.HttpStatusCode.BadRequest)
            {
                Content = new JsonContent(json)
            });
        }
Example #4
0
        public static HttpResponseMessage Create(System.Net.HttpStatusCode status, string message)
        {
            MyJsonResult json = MyJsonResult.CreateError(message);

            return(new HttpResponseMessage(status)
            {
                Content = new JsonContent(json)
            });
        }
Example #5
0
        public static HttpResponseMessage Create(Mvc5RQ.Models.RQKosBranch.RQKosBranchStatus status)
        {
            MyJsonResult json = MyJsonResult.CreateError(status);

            return(new HttpResponseMessage(System.Net.HttpStatusCode.OK)
            {
                Content = new JsonContent(json),
            });
        }
Example #6
0
        public static HttpResponseMessage Create(Exception exception, string message)
        {
            MyJsonResult json;
            Exception    iex = exception;

            while (iex != null)
            {
                if (!string.IsNullOrEmpty(iex.Message))
                {
                    message += "\n - " + iex.Message;
                }
                iex = iex.InnerException;
            }
            json = MyJsonResult.CreateError(message);
            return(new HttpResponseMessage(System.Net.HttpStatusCode.InternalServerError)
            {
                Content = new JsonContent(json),
            });
        }