예제 #1
0
        public VisitService(IUserService userService, DocDbContext dbContext)
        {
            _dbContext       = dbContext;
            this.userService = userService;
            _dbContext.Database.EnsureCreated();

            visits = new List <Visit>();

            if (_dbContext.Users.Count() == 0 && _dbContext.Visits.Count() == 0)
            {
                userService.AddUser(new User("Jan", "Kowalski", "jkowalski", "123", User.Role.Doctor));
                userService.AddUser(new User("Wojciech", "Rzezucha", "wrzezucha", "123", User.Role.Doctor));
                userService.AddUser(new User("Bart", "Gawrych", "bgawrych", "123", User.Role.Visitor));
                userService.AddUser(new User("Adam", "Grabowski", "agrabowski", "123", User.Role.Visitor));
                userService.AddUser(new User("Kamil", "Jablonski", "kjablonski", "123", User.Role.Visitor));

                AddVisit(new Visit(userService.GetUserByLogin("jkowalski"), userService.GetUserByLogin("agrabowski"), DateTime.Now));
                AddVisit(new Visit(userService.GetUserByLogin("jkowalski"), userService.GetUserByLogin("kjablonski"), DateTime.Now));
                AddVisit(new Visit(userService.GetUserByLogin("wrzezucha"), userService.GetUserByLogin("bgawrych"), DateTime.Now));
                AddVisit(new Visit(userService.GetUserByLogin("wrzezucha"), userService.GetUserByLogin("kjablonski"), DateTime.Now));
            }
        }
예제 #2
0
 public UserService(DocDbContext dbContext)
 {
     _dbContext = dbContext;
     users      = new List <User>();
     _dbContext.Database.EnsureCreated();
 }