Beispiel #1
0
        public virtual ActionResult DestinationTemplates(DataSourceRequest command)
        {
            if (!_permissionService.Authorize(StandardPermissionProvider.ManageMaintenance))
            {
                return(AccessDeniedKendoGridJson());
            }

            var templatesModel = _destinationTemplateService.GetAllDestinationTemplates()
                                 .Select(x => x.ToModel())
                                 .ToList();
            var gridModel = new DataSourceResult
            {
                Data  = templatesModel,
                Total = templatesModel.Count
            };

            return(Json(gridModel));
        }
Beispiel #2
0
        protected virtual void PrepareTemplatesModel(DestinationModel model)
        {
            if (model == null)
            {
                throw new ArgumentNullException("model");
            }

            var templates = _destinationTemplateService.GetAllDestinationTemplates();

            foreach (var template in templates)
            {
                model.AvailableDestinationTemplates.Add(new SelectListItem
                {
                    Text  = template.Name,
                    Value = template.Id.ToString()
                });
            }
        }