示例#1
0
        public IHttpActionResult Post([FromBody] int id)
        {
            try {
                var fi = _fontInfoService.GetFontInfo(id);
                if (fi == null)
                {
                    return(NotFound());
                }

                _imageService.CreateImage(fi.FilePath);
                return(Ok());
            } catch (Exception ex) {
                return(BadRequest(ex.Message));
            }
        }
        public IHttpActionResult GetFontInfo(int id)
        {
            try {
                var fi = _fontInfoService.GetFontInfo(id);
                if (fi == null)
                {
                    return(NotFound());
                }

                // Check if we have a font image or not
                var img = Path.Combine(Path.GetDirectoryName(fi.FilePath), Path.GetFileNameWithoutExtension(fi.FilePath) + ".png");
                if (File.Exists(img))
                {
                    fi.FontImagePath = img;
                }

                return(Ok(fi));
            } catch (Exception ex) {
                return(BadRequest(ex.Message));
            }
        }