Exemplo n.º 1
0
        //todo: mange this with attributres in in entity classes

        /*protected override void OnModelCreating(DbModelBuilder modelBuilder)
         * {
         *  modelBuilder.Entity<Sprint>()
         *      .HasKey(s => s.ID)
         *      .HasRequired(s => s.Project)
         *      .WithMany(p => p.Sprints)
         *      .HasForeignKey(s => s.ProjectId);
         *
         *  modelBuilder.Entity<Project>()
         *      .HasKey(p => p.ID)
         *      .HasOptional(p => p.Backlog);
         *
         *  modelBuilder.Entity<Feature>()
         *      .HasKey(s => s.ID)
         *      .HasRequired(s => s.Project)
         *      .WithMany(p => p.Features)
         *      .HasForeignKey(s => s.ProjectId);
         *
         *  modelBuilder.Entity<Project>()
         *      .HasKey(p => p.ID)
         *      .HasOptional(p => p.DefaultFeature);
         * }*/

        public async Task AddNewProject(Project project)
        {
            Projects.Insert(project);
            await SaveChangesAsync();

            var sprint = new Sprint("Backlog", project);

            Sprints.Insert(sprint);

            project.BacklogId           = sprint.ID;
            project.NextProjectTicketId = 1;
            await SaveChangesAsync();
        }
Exemplo n.º 2
0
        public async Task DeleteSprint(Sprint sprint)
        {
            var linkedTickets = Tickets.Where(x => x.Feature.SprintId == sprint.ID);

            Tickets.RemoveRange(linkedTickets);

            var linkedFeatures = Features.Where(x => x.SprintId == sprint.ID);

            Features.RemoveRange(linkedFeatures);

            var linkedProjects = Projects.Where(x => x.BacklogId == sprint.ID);

            Projects.ToList().ForEach(x => x.BacklogId = null);

            Sprints.Remove(sprint);

            await SaveChangesAsync();
        }
Exemplo n.º 3
0
 public Feature(string name, Sprint sprint)
     : base(sprint.Context)
 {
     this.Name     = name;
     this.SprintId = sprint.ID;
 }