Пример #1
0
        public HttpResponseMessage GetAgentQrCode(string code)
        {
            try
            {
                var service = new UtilityService();

                var wxservice = new WxService();

                var qrcontent = code + "|" + wxservice.GetNickNameByAgentCode(code);

                var imgByte = service.GetGetQrCode(qrcontent);

                var resp = new HttpResponseMessage(HttpStatusCode.OK)
                {
                    Content = new ByteArrayContent(imgByte)
                };
                resp.Content.Headers.ContentType = new MediaTypeHeaderValue("image/png");

                return(resp);
            }
            catch (Exception ex)
            {
                var resp = new HttpResponseMessage(HttpStatusCode.InternalServerError)
                {
                    Content = new StringContent(ex.Message)
                };
                resp.Content.Headers.ContentType = new MediaTypeHeaderValue("text/plain");

                return(resp);
            }
        }