public HttpResponseMessage Get(string vsixId)
        {
            using (var ctx = new GalleryContext())
            {
                var ex = ctx.GetExtensionByVsixId(vsixId);
                if (ex == null)
                {
                    return(new HttpResponseMessage(HttpStatusCode.NotFound));
                }

                return(new DownloadImageResponseMessage(ex.PreviewImageContent, ex.PreviewImage));
            }
        }
示例#2
0
        public HttpResponseMessage Get(string vsixId)
        {
            using (var ctx = new GalleryContext())
            {
                var extension = ctx.GetExtensionByVsixId(vsixId);
                if (extension == null)
                {
                    return(new HttpResponseMessage(HttpStatusCode.NotFound));
                }

                extension.IncreaseDownloadCount();
                ctx.SaveChanges();
                return(new DownloadExtensionResponseMessage(extension));
            }
        }