Пример #1
0
		public async Task<ActionResult> Image(int id, int size = 128)
		{
			var speakerDataProvider = new SpeakerDataProvider();
			var image = await speakerDataProvider.GetSpeakerImage(id);
			if (image == null)
			{
				return File("~/Content/images/anon.jpg", "image/jpeg", "anon.jpg");
			}
			var resizedImage = ImageResizer.ResizeImage(image, size);
			return File(resizedImage, "image/png", id + ".png");
		}
Пример #2
0
		public void ImageAsync(int id, int size = 128)
		{
			AsyncManager.OutstandingOperations.Increment();
			var speakerDataProvider = new SpeakerDataProvider();
			speakerDataProvider.GetSpeakerImage(id).ContinueWith(d =>
			{
				AsyncManager.Parameters["image"] = d.Result;
				AsyncManager.Parameters["size"] = size;
				AsyncManager.Parameters["id"] = id;
				AsyncManager.OutstandingOperations.Decrement();
			});
		}