Esempio n. 1
0
        public IFluentAddressBook AddAddressBook(CustomerView customerView)
        {
            try
            {
                Task <AddressBook> lookupAddressBookTask = Task.Run(async() => await unitOfWork.addressBookRepository.GetAddressBookByCustomerView(customerView));
                Task.WaitAll(lookupAddressBookTask);
                if (lookupAddressBookTask.Result == null)
                {
                    AddressBook addressBook = new AddressBook();


                    applicationViewFactory.MapAddressBookEntity(ref addressBook, customerView);
                    AddAddressBook(addressBook);

                    return(this as IFluentAddressBook);
                }

                processStatus = CreateProcessStatus.AlreadyExists;
                return(this as IFluentAddressBook);
            }
            catch (Exception ex)
            {
                throw new Exception(GetMyMethodName(), ex);
            }
        }
Esempio n. 2
0
        public async Task <CreateProcessStatus> CreateAddressBook(CustomerView customerView)
        {
            try
            {
                AddressBook lookupAddressBook = await base.GetAddressBookByCustomerView(customerView);

                if (lookupAddressBook == null)
                {
                    AddressBook addressBook = new AddressBook();

                    applicationViewFactory.MapAddressBookEntity(ref addressBook, customerView);
                    AddObject(addressBook);
                    return(CreateProcessStatus.Insert);
                }

                return(CreateProcessStatus.AlreadyExists);
            }
            catch (Exception ex)
            {
                throw new Exception(GetMyMethodName(), ex);
            }
        }