Example #1
0
        public ActionResult Index()
        {
            var config = CodeInsideConfig.GetConfig();

            ViewBag.Url = config.WebUrl;
            ViewBag.Id  = config.Id;

            ViewBag.NumberOfAuthors = config.Authors.Count;

            return(View());
        }
        public ActionResult Index()
        {
            ViewData["Message"] = "Welcome to ASP.NET MVC!";
            CodeInsideConfig config = CodeInsideConfig.GetConfig();

            ViewData["webUrl"]    = config.WebUrl;
            ViewData["startedOn"] = config.StartedOn;

            string authors = "";

            foreach (CodeInsideConfigAuthor author in config.Authors)
            {
                authors += author.Name + ",";
            }

            ViewData["authors"] = authors;

            return(View());
        }
Example #3
0
        public ActionResult About()
        {
            var config = CodeInsideConfig.GetWritableBaseConfig();

            var writableConfigSection = config.GetSection("codeInsideConfig") as CodeInsideConfig;

            writableConfigSection.Id = Guid.NewGuid();
            writableConfigSection.Authors.Add(new CodeInsideConfigAuthor()
            {
                Name = "Hello World!" + Guid.NewGuid()
            });

            try
            {
                config.Save();
                return(RedirectToAction("Index", "Home"));
            }
            catch (ConfigurationErrorsException exc)
            {
                throw;
            }
        }