Example #1
0
        public async Task Initial()
        {
            await _context.Database.MigrateAsync();

            //Creating the roles
            await _accountService.CreateRole(Roles.ADMIN_ROLE);

            await _accountService.CreateRole(Roles.SUPPLIER_ROLE);

            await _accountService.CreateRole(Roles.USER_ROLE);

            await _accountService.CreateRole(Roles.WAREHOUSE_MANAGER_ROLE);

            //Creating the admin
            try
            {
                await _accountService.GetUserByUserName("admin");
            }
            catch (ServiceException)
            {
                await _accountService.CreateUser(new User()
                {
                    UserName = "******", Email = "*****@*****.**"
                }, "1234Qwer@", Roles.ADMIN_ROLE);
            }

            //Create tax percentage settings
            await _settingService.CreateOrUpdateValue(Settings.TAX_PERCENTAGE, "0.08");
        }