public async Task TestUpdateAddressBook() { long addressId = 1; AddressBookModule abMod = new AddressBookModule(); AddressBookView addressBookView = new AddressBookView(); addressBookView.AddressId = addressId; addressBookView.FirstName = "David2"; addressBookView.LastName = "Nishimoto"; addressBookView.Name = "David Nishimoto"; abMod.AddressBook.UpdateAddressBookByView(addressBookView).Apply(); AddressBook addressBook2 = await abMod.AddressBook.Query().GetEntityById(addressId); string name = addressBook2.FirstName; Assert.Equal("David2", name); addressBook2.FirstName = "David"; abMod.AddressBook.UpdateAddressBook(addressBook2).Apply(); AddressBook addressBook3 = await abMod.AddressBook.Query().GetEntityById(addressId); name = addressBook3.FirstName; Assert.Equal("David", name); }
public IFluentAddressBook UpdateAddressBookByView(AddressBookView view) { Task <AddressBook> addressBookTask = Task.Run(async() => await MapToEntity(view)); Task.WaitAll(addressBookTask); AddAddressBook(addressBookTask.Result); return(this as IFluentAddressBook); }
//public IFluentAddressBook MapAddressBookEntity(ref AddressBook addressBook, AddressBookView addressBookView) //{ // unitOfWork.addressBookRepository.MapAddressBookEntity(ref addressBook, addressBookView); // return this as IFluentAddressBook; //} private async Task <AddressBook> MapToEntity(AddressBookView inputObject) { Mapper mapper = new Mapper(); AddressBook outObject = mapper.Map <AddressBook>(inputObject); await Task.Yield(); return(outObject); }