public static void ConfigureRepository() { Database.DefaultConnectionFactory = new SqlCeConnectionFactory("System.Data.SqlServerCe.4.0"); Database.SetInitializer(new AlwaysRecreateDatabase<Repository>()); using (var context = new Repository()) CreateSampleData(context); }
public ActionResult Listing() { var repository = new Repository(); return View(repository.Sprints.Select(x => new SprintSummary { Id = x.SprintId, Title = x.Goal })); }
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(); }
public ActionResult Details(long id) { var repository = new Repository(); var sprint = repository.Sprints.Find(id); var stories = from story in sprint.Stories select new StorySummary { Id = story.StoryId, Title = story.Name, Notes = story.Notes }; return View(new SprintDetails { Id = sprint.SprintId, Title = sprint.Goal, //StartDate = sprint.StartDate.ToLongDateString(), Stories = stories }); }