Example #1
0
        public async Task EnsureSeedData()
        {
            if (await _manager.FindByEmailAsync("*****@*****.**") == null)
            {
                var user = new TinyHubUser()
                {
                    UserName = "******",
                    Email    = "*****@*****.**"
                };

                await _manager.CreateAsync(user, "P@ssw0rd!!!%");
            }

            if (!_context.Projects.Any())
            {
                var initialProject = new Project()
                {
                    DateCreated      = DateTime.Now,
                    IsPrivateProject = false,
                    Name             = "School project No.1",
                    UserName         = "******",
                    Bugs             = new List <Bug>
                    {
                        new Bug()
                        {
                            Description = "Test description", FromProject = "School project No.1", Priority = PriorityType.Urgent, UserCalling = "Test1"
                        }
                    }
                };

                _context.Projects.Add(initialProject);

                var initiajProjectNo2 = new Project()
                {
                    DateCreated      = DateTime.Now,
                    IsPrivateProject = true,
                    Name             = "School project No.2",
                    UserName         = "******",
                    Bugs             = new List <Bug>
                    {
                        new Bug()
                        {
                            Description = "Test description 2", FromProject = "School project No.2", Priority = PriorityType.High, UserCalling = "Test1"
                        }
                    }
                };

                _context.Projects.Add(initiajProjectNo2);

                await _context.SaveChangesAsync();
            }
        }
Example #2
0
 public void AddProject(Project newProject)
 {
     _context.Projects.Add(newProject);
     _context.SaveChangesAsync();
 }