예제 #1
0
        protected void Application_Start()
        {
            UserAppService _userService = new UserAppService();
            RoleAppService _roleService = new RoleAppService();

            if (!_roleService.Any(x => x.Name == "Admin"))
            {
                RoleApp role1 = new RoleApp();
                role1.Name = "Admin";
                _roleService.Insert(role1);
            }
            if (!_roleService.Any(x => x.Name == "User"))
            {
                RoleApp role2 = new RoleApp();
                role2.Name = "User";
                _roleService.Insert(role2);
            }
            if (!_userService.Any(x => x.Email == "*****@*****.**"))
            {
                UserApp user = new UserApp();
                user.Email       = "*****@*****.**";
                user.Password    = CryptoService.MD5Password("123");
                user.UserName    = "******";
                user.CreateDate  = DateTime.Now;
                user.DateOfEntry = DateTime.Now;
                user.IsActive    = true;
                user.RoleId      = 1;
                _userService.Insert(user);
            }
            _userService.Dispose();
            _userService.Dispose();
            AreaRegistration.RegisterAllAreas();
            RouteConfig.RegisterRoutes(RouteTable.Routes);
        }