Ejemplo n.º 1
0
        public ActionResult Update(int?id)
        {
            var culture = _cultureService.Get(id.GetValueOrDefault());

            var model = Mapper.Map <CultureViewModel>(culture);

            return(View("CreateOrUpdate", model));
        }
Ejemplo n.º 2
0
        public async Task <Lookups> Get()
        {
            var result   = new Lookups();
            var cats     = new List <SelectOption>();
            var category = await _categoryService.GetAll();

            foreach (var cat in category)
            {
                cats.Add(new SelectOption {
                    OptionName = cat.Title, OptionValue = cat.Id.ToString()
                });
            }
            result.CategoryList      = cats;
            result.Cultures          = _cultureService.Get();
            result.SelfRegisterRoles = new List <SelectOption>();
            var    task           = _userManager.GetUsersInRoleAsync("Administrator");
            var    administrators = task.Result;
            Author author         = new Author();
            bool   isSelected     = false;
            var    items          = new List <SelectOption>();

            foreach (var item in administrators)
            {
                author.Id          = item.Id;
                author.DisplayName = item.DisplayName;
                author.Signature   = item.Signature;
                author.Name        = item.UserName;
                var json = Newtonsoft.Json.JsonConvert.SerializeObject(author);
                items.Add(new SelectOption {
                    OptionName = item.DisplayName, OptionValue = author.Id, IsSelected = isSelected
                });
            }
            result.AuthorList = items;
            var pages = new List <SelectOption>();

            result.PageList        = pages;
            result.InstalledThemes = new List <SelectOption>();
            result.PostOptions     = new EditorOptions
            {
                OptionType       = "Post",
                ShowSlug         = true,
                ShowDescription  = true,
                ShowCustomFields = true,
                ShowAuthors      = true
            };
            result.PageOptions = new EditorOptions
            {
                OptionType       = "Page",
                ShowSlug         = true,
                ShowDescription  = true,
                ShowCustomFields = true
            };
            return(result);
        }