Beispiel #1
0
        public static void Seed(this diaryAppContext dbContext)
        {
            // add User
            dbContext.Users.Add(new Users
            {
                Id       = "testUser1",
                Fname    = "UserFirstname1",
                Lname    = "UserLastname1",
                Nickname = "UserNickName1",
                Email    = "*****@*****.**",
                Password = GetHashpassword("12345")
            });

            dbContext.SaveChangesAsync();


            // add Event
            dbContext.Events.Add(new Events
            {
                EventName = "testEvent1",
                DateTime  = new DateTime(2008 - 05 - 01),
                Memo      = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc nec tristique tellus, eget interdum massa. In hac habitasse platea dictumst. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce convallis felis dignissim egestas tristique. Quisque elementum sed diam ac varius. Sed sollicitudin venenatis sodales. Maecenas malesuada metus vitae tellus accumsan, et cursus mauris tincidunt. Suspendisse in nibh luctus, maximus mauris eu, efficitur justo. Morbi eu justo sed quam sodales mollis. Nulla eget suscipit nisl. Nam efficitur vestibulum orci, quis placerat nibh ultricies sit amet. In hac habitasse platea dictumst. Vivamus vel accumsan nisi.",
                UserId    = "testUser1"
            });


            dbContext.SaveChangesAsync();
        }
Beispiel #2
0
        /// create database
        public diaryAppContext createTestingDB(string name)
        {
            var options = new DbContextOptionsBuilder <diaryAppContext>()
                          .UseInMemoryDatabase(databaseName: name)
                          .Options;

            var dbContext = new diaryAppContext(options);

            dbContext.Seed();

            return(dbContext);
        }
Beispiel #3
0
 public EventService(diaryAppContext dbContext)
 {
     db = dbContext;
 }
Beispiel #4
0
 public AuthService(diaryAppContext dbContext)
 {
     db = dbContext;
 }