public IQueryable <Sprint> GetMySprints(IPrincipal User) { ApplicationUser currentUser = GetUser(User.Identity); if (currentUser == null) { return(Enumerable.Empty <Sprint>().AsQueryable()); } return(Sprints.Where(s => s.Project.User.Id == currentUser.Id)); }
public async Task DeleteProject(Project project) { var linkedTickets = Tickets.Where(x => x.Feature.Sprint.ProjectId == project.ID).ToList(); Tickets.RemoveRange(linkedTickets); var linkedFeatures = Features.Where(x => x.Sprint.ProjectId == project.ID); Features.RemoveRange(linkedFeatures); var linkedSprints = Sprints.Where(x => x.ProjectId == project.ID); Sprints.RemoveRange(linkedSprints); await SaveChangesAsync(); Projects.Remove(project); await SaveChangesAsync(); }