public Task AddAsync(Organization organization, CancellationToken cancellationToken = default(CancellationToken)) { cancellationToken.ThrowIfCancellationRequested(); if (organization == (Organization)null) throw new ArgumentNullException("organization"); this._organizationRepository.Add(organization); return this._organizationRepository.UnitOfWork.CommitAsync(cancellationToken); }
public void UserRepository_AddTest_ValidUser_NewAddress() { IOrganizationRepository repo = IoCFactory.Instance.CurrentContainer.Resolve<IOrganizationRepository>(); Organization org = new Organization() { Id = new Guid("514c5873-bee8-cc78-3de8-08d1b9e806d0"), Name = "*****@*****.**", Address = new Address() { Id = Guid.NewGuid(), AddressLine1 = "test2", ZipCode = "12352", City = "Test2" } }; repo.Add(org); repo.UnitOfWork.Commit(); Organization byId = repo.GetElementById(org.Id); Assert.IsNotNull(byId); Assert.IsTrue(byId.Id == org.Id); }
public static Organization ToModel(this FacilityCreateViewModel model) { Organization entity = null; if (model != null) { entity = new Organization() { Id = Guid.NewGuid(), Name = model.Name, Address = new Address() { Id=Guid.NewGuid(), AddressLine1 = model.Address, City = model.City, ZipCode=model.ZipCode } }; } return entity; }