public HttpResponseMessage GetImage(int id) { try { var user = UserCommand.Get(id); MemoryStream img = user.Image.Base64ToImageMemoryStreamMemory(); HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); result.Content = new ByteArrayContent(img.ToArray()); result.Content.Headers.ContentType = new MediaTypeHeaderValue("image/png"); return(result); } catch (Exception) { MemoryStream img = ImageExtensions.ImageMemoryStreamFromContentFolder("no-image.png"); HttpResponseMessage result = new HttpResponseMessage(HttpStatusCode.OK); result.Content = new ByteArrayContent(img.ToArray()); result.Content.Headers.ContentType = new MediaTypeHeaderValue("image/png"); return(result); } }