Ejemplo n.º 1
0
        public IActionResult ProveIt()
        {
            UserListViewModel vm   = new UserListViewModel();
            PRPCRepository    repo = new PRPCRepository();

            using (repo.Context = new PRPCRepositoryDbContext())
            {
                vm.Users = repo.Context.Users.ToList();
            }

            return(View(vm));
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            PRPCRepository repo = new PRPCRepository();

            using (repo.Context = new PRPCRepositoryDbContext())
            {
                repo.Context.Database.EnsureCreated();

                if (!repo.Context.Users.Any())
                {
                    List <User> users = new List <User>()
                    {
                        new User()
                        {
                            Email       = "*****@*****.**",
                            FirstName   = "Test1",
                            LastName    = "Tester1",
                            Password    = "******",
                            PhoneNumber = "808-555-5555",
                            RequestId   = "stuff1"
                        },
                    };

                    repo.Context.Users.AddRange(users);

                    repo.Context.SaveChanges();
                }
                else
                {
                    User user = new User();
                    user.Email       = "*****@*****.**";
                    user.FirstName   = "Test";
                    user.LastName    = "Tester";
                    user.Password    = "******";
                    user.PhoneNumber = "808-555-5555";
                    user.RequestId   = "stuff";

                    repo.Context.Users.Add(user);
                    repo.Context.SaveChanges();
                    Console.WriteLine(repo.Hello());
                }
            }
        }