// GET api/file/{id} public HttpResponseMessage Get(string id) { HttpResponseMessage response = Request.CreateResponse(); InputImageEntity imageEntry = InputImageModel.Get(id); if (imageEntry == null) { return(this.Request.CreateResponse(HttpStatusCode.NotFound)); } MemoryStream ms = new MemoryStream(); BlobModel.Download(id, ms); response.Content = new ByteArrayContent(ms.ToArray()); // only jpeg response.Content.Headers.TryAddWithoutValidation("Content-Type", "image/jpeg"); return(response); }
// POST api/processing public async Task <JobOrderDTO> Post([FromBody] ProcessOrderDTO processOrderDTO) { InputImageEntity imageEntity = InputImageModel.Get(processOrderDTO.ImageId); if (imageEntity == null) { // return this.Request.CreateResponse(HttpStatusCode.NotFound); return(null); } Guid g = System.Guid.NewGuid(); string orderId = g.ToString("N").Substring(0, 15); ImageProcessJobModel.Crate(orderId, imageEntity.RowKey); // send job QueueModel.SendMessage(orderId, processOrderDTO.ImageId, "default"); return(new JobOrderDTO() { OrderId = orderId }); }