public ActionResult Index()
        {
            TagsBlocksVM vm = new TagsBlocksVM();
            vm.blocks = db.Blocks.ToList();
            vm.tags = db.Tags.ToList();

            return View(vm);
        }
Ejemplo n.º 2
0
        // write all object Sessions, Speakers, Block, Tags, etc to json file Data/boostrap_data1.json for mobile app
        public ActionResult WriteToJson()
        {
            TagsBlocksVM vm = new TagsBlocksVM();
            vm.blocks = db.Blocks.ToList();
            vm.tags = db.Tags.ToList();
            vm.rooms = db.Rooms.ToList();
            vm.hashtags = db.Hashtags.ToList();
            vm.speakers = db.Speakers.ToList();
            vm.sessions = db.Sessions.ToList();

            var serializedObject = JsonConvert.SerializeObject(vm, Formatting.Indented);
            var path = Server.MapPath(@"~/Data/bootstrap_data1.json");

            System.IO.File.WriteAllText(path, serializedObject);

            return RedirectToAction("Index", "Dashboard");
        }