Exemplo n.º 1
0
        public bool CreateSupplier(AddressBook addressBook, EmailEntity emailEntity, LocationAddress locationAddress)
        {
            try
            {
                AddressBook
                .CreateSupplierAddressBook(addressBook, emailEntity)
                .Apply();

                Task <AddressBook> addressBookLookupTask = Task.Run(async() => await AddressBook.Query().GetAddressBookbyEmail(emailEntity.Email));

                locationAddress.AddressId = addressBookLookupTask.Result.AddressId;

                LocationAddress

                .AddLocationAddress(locationAddress)
                .Apply();

                Email.CreateSupplierEmail(addressBook.AddressId, emailEntity).Apply();

                Supplier supplier = new Supplier {
                    AddressId = addressBook.AddressId, Identification = emailEntity.Email
                };

                Supplier
                .AddSupplier(supplier)
                .Apply();
                return(true);
            }
            catch (Exception ex) { throw new Exception("CreateSupplier", ex); }
        }