private void PupulateAviliableTemplates(Guid?selectedTemplateId = null)
        {
            var templates         = _templateRepository.GetAll();
            var aviliableTempates = templates.Select(x => new SelectListItem()
            {
                Text = x.Name, Value = x.Id.ToString(), Selected = selectedTemplateId == x.Id
            }).ToList();

            aviliableTempates.Insert(0, new SelectListItem()
            {
                Text = "Select Template"
            });
            ViewBag.AviliableTemplates = aviliableTempates;
        }
        private dynamic CreateViewBag()
        {
            dynamic viewbag     = new ExpandoObject();
            var     dictViewbag = viewbag as IDictionary <String, object>;
            var     settings    = _settingsRepository.GetAll();

            foreach (var item in settings)
            {
                dictViewbag.TryAdd(item.Key, item.Value);
            }
            return(viewbag);
        }
Exemplo n.º 3
0
        private void PupulateAviliableTemplates(Guid?selectedTemplateId = null, List <Guid> excludeIds = null)
        {
            var templates = _templateRepository.GetAll();

            if (excludeIds == null)
            {
                excludeIds = new List <Guid>(0);
            }
            var aviliableTempates = templates.Where(x => !excludeIds.Contains(x.Id)).Select(x => new SelectListItem()
            {
                Text     = x.Name,
                Value    = x.Id.ToString(),
                Selected = selectedTemplateId == x.Id
            }).ToList();

            aviliableTempates.Insert(0, new SelectListItem()
            {
                Text = "Select Template"
            });
            ViewBag.AviliableTemplates = aviliableTempates;
        }