コード例 #1
0
 public SqlTicketRepo(BugTrackerContext context)
 {
     _context = context;
 }
コード例 #2
0
 public BugTrackerRepository(BugTrackerContext context, ILogger <BugTrackerRepository> logger)
 {
     _context = context;
     _logger  = logger;
 }
コード例 #3
0
 public SqlAccountRepo(BugTrackerContext context)
 {
     _context = context;
 }
コード例 #4
0
        public static void Initialize(BugTrackerContext context)
        {
            context.Database.EnsureDeleted();
            context.Database.EnsureCreated();

            if (context.Users.Any())
            {
                return;
            }

            var users       = new List <User>();
            var projects    = new List <Project>();
            var tickets     = new List <Ticket>();
            var comments    = new List <Comment>();
            var attachments = new List <Attachment>();

            Project project = new Project {
                Id = 1, Title = "project", Description = "description"
            };

            User Andrei = new User {
                Name = "Andrei", Email = "*****@*****.**", Id = 1, Role = Role.Admin
            };
            User Stefan = new User {
                Name = "Stefan", Email = "*****@*****.**", Id = 2, Role = Role.ProjectManager
            };
            User Greg = new User {
                Name = "Greg", Email = "*****@*****.**", Id = 3, Role = Role.Developer
            };
            User Robert = new User {
                Name = "Robert", Email = "*****@*****.**", Id = 4, Role = Role.Submitter
            };


            Ticket ticket = new Ticket
            {
                Id              = 1, Title = "ticket", Description = "description",
                Priority        = Priority.High,
                Status          = Status.InProgress,
                Type            = Type.Bugs, CreatedDateTime = DateTime.Now,
                UpdatedDateTime = DateTime.Now
            };

            Comment comment = new Comment {
                Id = 1, CreatedDateTime = DateTime.Now, Message = "make better"
            };

            Attachment attachment = new Attachment {
                Id = 1, CreatedDateTime = DateTime.Now, Notes = "null file"
            };

            users.Add(Andrei);
            users.Add(Stefan);
            users.Add(Greg);
            users.Add(Robert);
            tickets.Add(ticket);
            comments.Add(comment);
            attachments.Add(attachment);
            projects.Add(project);

            //Andrei.Projects = projects;

            foreach (User u in users)
            {
                context.Users.Add(u);
            }

            context.SaveChanges();

            foreach (Project p in projects)
            {
                context.Projects.Add(p);
            }

            context.SaveChanges();

            foreach (Ticket t in tickets)
            {
                context.Tickets.Add(t);
            }

            context.SaveChanges();

            foreach (Comment c in comments)
            {
                context.Comments.Add(c);
            }

            context.SaveChanges();

            foreach (Attachment a in attachments)
            {
                context.Attachments.Add(a);
            }

            context.SaveChanges();
        }
コード例 #5
0
 public SqlAttachmentRepo(BugTrackerContext context)
 {
     _context = context;
 }
コード例 #6
0
 public BugTrackerSeeder(BugTrackerContext context, IWebHostEnvironment env)
 {
     _context = context;
     _env     = env;
 }
コード例 #7
0
ファイル: SqlTeamRepo.cs プロジェクト: ahmaazouzi/bug-tracker
 public SqlTeamRepo(BugTrackerContext context)
 {
     _context = context;
 }
コード例 #8
0
 public SqlAssignmentRepo(BugTrackerContext context)
 {
     _context = context;
 }
コード例 #9
0
 public SqlCommentRepo(BugTrackerContext context)
 {
     _context = context;
 }
コード例 #10
0
 public SqlSprintRepo(BugTrackerContext context)
 {
     _context = context;
 }