public ActionResult <Cat> GetOne(int index) { try { return(Ok(_cs.GetCat(index))); } catch (System.Exception err) { return(BadRequest(err.Message)); } }
public async Task <ActionResult> Cat([FromQuery] string tag, [FromQuery] string text, [FromQuery] float?alpha, [FromQuery] float?scale) { var bytes = await CatService.GetCat(tag); var inputStream = new MemoryStream(bytes); var outStream = new MemoryStream(); var bitmap = new Bitmap(inputStream); var transformations = TransformationFactory.Transformations(alpha, text, scale); foreach (var transformation in transformations) { bitmap = transformation.ApplyTransformation(bitmap); } bitmap.Save(outStream, ImageFormat.Jpeg); outStream.Position = 0; return(File(outStream, "image/jpg")); }
public ActionResult <Cat> GetCat(string id) { return(service.GetCat(id)); }