Ejemplo n.º 1
0
        public static Response Success(object obj)
        {
            var result = new NancyResult
            {
                Status  = NancyResponseStatus.Success,
                Message = "Success",
                Content = JsonConvert.SerializeObject(obj),
            };

            var response = (Response)(JsonConvert.SerializeObject(result));

            response.ContentType = "application/json";
            return(response);
        }
Ejemplo n.º 2
0
        public static Response Error(string errorMsg, string url, string stackTrace)
        {
            var result = new NancyResult
            {
                Status     = NancyResponseStatus.Failed,
                Message    = errorMsg,
                Content    = string.Empty,
                Url        = url,
                StackTrace = stackTrace,
            };

            var response = (Response)(JsonConvert.SerializeObject(result));

            response.ContentType = "application/json; charset=utf-8";
            return(response);
        }