Exemplo n.º 1
0
        public void CreateOrg()
        {
            Organisation organisation = new Organisation
            {
                Name     = "Lukas coola ställe",
                Email    = "*****@*****.**",
                Password = PasswordHasher.CreateHash("12345")
            };

            _or.Add(organisation);
        }
        public async Task <Organisation> Add(Organisation newOrg)
        {
            if (_orgRepository
                .Search(o => o.Name.ToLower() == newOrg.Name.ToLower())
                .Result.Any())
            {
                return(null);
            }

            await _orgRepository.Add(newOrg);

            return(newOrg);
        }
Exemplo n.º 3
0
        public Organisation CreateOrganisation(CreateOrganisationParameters param)
        {
            using (TransactionScope scope = new TransactionScope(TransactionScopeOption.Required, SociatisTransactionOptions.RepeatableRead))
            {
                var entity       = entityService.CreateEntity(param.Name, EntityTypeEnum.Organisation);
                var organisation = new Organisation()
                {
                    Entity    = entity,
                    OwnerID   = param.OwnerID,
                    CountryID = param.CountryID
                };

                organisationRepository.Add(organisation);
                organisationRepository.SaveChanges();

                scope.Complete();
                return(organisation);
            }
        }