Exemple #1
0
        public JsonResult Get(int id, string l)
        {
            var quote = _repository.GetById(id);

            if (l == null || l.Length == 0)
            {
                return(Json(Mapper.Map <IEnumerable <ZenMessageViewModel> >(new List <ZenQuote>()
                {
                    quote
                })));
            }
            return(Json(ZenMessageConverter.Convert(quote, l)));
        }
Exemple #2
0
        public IActionResult Image(int id, string l)
        {
            var quote = _repository.GetById(id);

            if (l == null || l.Length == 0)
            {
                l = "EN";
            }

            var viewModel = ZenMessageConverter.Convert(quote, l);

            var quoteImage = new ZenQuoteImage(viewModel, _hostingEnvironment);

            return(File(quoteImage.GetImage(), "image/png"));
        }