Ejemplo n.º 1
0
 public MvcHtmlString RenderResourceScript(string name)
 {
     if (_scriptService.GetAll().Any(s => s.Name.Equals(name, StringComparison.CurrentCultureIgnoreCase)))
     {
         var tag = new TagBuilder("script");
         tag.Attributes.Add("src", string.Format(EzCMSContants.ScriptResourceUrl, name));
         return(new MvcHtmlString(tag.ToString(TagRenderMode.Normal)));
     }
     return(new MvcHtmlString(string.Empty));
 }
Ejemplo n.º 2
0
 public IActionResult GetAll()
 {
     _logger.LogInformation("Get all scripts");
     try
     {
         var scripts = _scriptService.GetAll();
         var model   = _mapper.Map <IList <ScriptModel> >(scripts);
         _logger.LogInformation("Scripts retrieved : {scriptCount}", model.Count);
         return(Ok(model));
     }
     catch (Exception ex)
     {
         _logger.LogError(ex, "Fatal failure");
         return(StatusCode(StatusCodes.Status500InternalServerError, new { message = "Fatal internal error. Please contact administrator" }));
     }
 }