예제 #1
0
 public ActionResult <Cat> GetOne(int index)
 {
     try
     {
         return(Ok(_cs.GetCat(index)));
     }
     catch (System.Exception err)
     {
         return(BadRequest(err.Message));
     }
 }
예제 #2
0
        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"));
        }
예제 #3
0
 public ActionResult <Cat> GetCat(string id)
 {
     return(service.GetCat(id));
 }