Exemple #1
0
 // GET: /Story/Create
 public ActionResult Create()
 {
     var story = new Story();
     story.Resources = new List<Resource>();
     PopulateAssignedResources(story);
     return View();
 }
Exemple #2
0
 private void PopulateAssignedResources(Story story)
 {
     var allStories = db.Stories;
     var linkedResources = story.Resources == null ? null : new HashSet<Resource>(story.Resources.Select(r => r));
     var viewModel = new List<StoryViewModel>();
     foreach (var r in allStories)
     {
         viewModel.Add(new StoryViewModel
         {
             Story = r,
             Resources = linkedResources,
         });
     }
     ViewBag.Stories = viewModel;
 }