public string Init() { _loginService.Register( new Model.DTO.UserInfoDTO.LoginPassword() { Login = "******", Password = "******" }, Constants.RoleNames.Admin); _adminRepository.Create(new Admin() { FIO = "DimaK", Login = "******" }); _userLoginInfoRepository.SaveChanges(); _loginService.Register( new Model.DTO.UserInfoDTO.LoginPassword() { Login = "******", Password = "******" }, Constants.RoleNames.Integrator); var ug = _userGroupRepository.Create(new UserGroup() { Name = "test1", }); _userRepository.Create(new User() { Login = "******", UserGroupId = ug.Id, UserType = UserType.Integrator }); var sc = _scenarioRepository.CreateScenario(new Scenario() { Author = "DimaIntegr", Description = "test", Name = "test", Publicity = false, Script = "TestScript", Type = 1, UserGroupId = ug.Id }); var ct = _controllerRepository.CreateController(new SmartController() { Adress = "http://localhost:5000/api", Description = "test", Name = "test", Password = "******", Type = 1, UserGroupId = ug.Id }); var list = new List <KeyValuePair <long, bool> >(); list.Add(new KeyValuePair <long, bool>(sc.Id, true) ); _connections.Set(list, ct.Id); _userGroupRepository.SaveChanges(); return(ct.Id.ToString() + " " + sc.Id.ToString()); }
public long CreateUserGroup([FromBody] CreateUserGroup input) { var userGroup = _createUserGroupMapper.Map(input); _repository.Create(userGroup); _repository.SaveChanges(); return(userGroup.Id); }