private async Task <Image <Rgba32> > LoadImageAsync(string id, IPhotoStorageService photoStorageService) { using (var inputStream = await photoStorageService.GetPhoto(id)) { return(Image.Load <Rgba32>(inputStream)); } }
public async Task ProcessRequest(IDotvvmRequestContext context) { var id = (string)context.Parameters["id"]; using (var stream = await photoStorageService.GetPhoto(id)) { context.HttpContext.Response.ContentType = "image/jpeg"; await stream.CopyToAsync(context.HttpContext.Response.Body); } }