public RedirectToRouteResult Create(StoryCreate model) { var repository = new Repository(); var sprint = repository.Sprints.Find(model.SprintId); sprint.Stories.Add(new Story { Name = model.Name, Notes = model.Notes }); repository.SaveChanges(); return RedirectToAction("Details", "Sprint", new { id = model.SprintId }); }
public static void CreateSampleData(Repository repository) { repository.Sprints.Add(new Sprint { Goal = "Undertake a long project", //StartDate = new DateTime(1449, 03, 27), Stories = new[] { new Story { Name = "Build a long wall", Notes = "As long as China" } } }); repository.Sprints.Add(new Sprint { Goal = "Build a Scrum system", //StartDate = new DateTime(2010, 07, 24), Stories = new[] { new Story { Name = "Test <Encoding>", Notes = "Use some \"unusual\" characters" }, new Story { Name = "Try a story with no extra notes" } } }); repository.SaveChanges(); }