public async Task <CustomerAuthTicket> AddCustomerAccount(CustomerAccountAndAuthInfo account, Credit credit, Wishlist wishlist) { var notes = new List <string>(); var customerAccountResource = new CustomerAccountResource(_apiContext); var newAccount = await customerAccountResource.AddAccountAndLoginAsync(account); notes.Add(string.Format("updatedby:{0},updatedDate:{1},action:{2}", newAccount.CustomerAccount. AuditInfo.UpdateBy, newAccount.CustomerAccount.AuditInfo.UpdateDate, "AddAccountAndLoginAsync")); var customerContactResource = new CustomerContactResource(_apiContext); foreach (var contact in account.Account.Contacts) { contact.AccountId = newAccount.CustomerAccount.Id; var newContact = await customerContactResource.AddAccountContactAsync(contact, newAccount.CustomerAccount.Id); notes.Add(string.Format("updatedby:{0},updatedDate:{1},action:{2}", newAccount.CustomerAccount. AuditInfo.UpdateBy, newAccount.CustomerAccount.AuditInfo.UpdateDate, "AddAccountContactAsync")); } var customerCreditResource = new CreditResource(_apiContext); credit.CustomerId = newAccount.CustomerAccount.Id; var newCredit = await customerCreditResource.AddCreditAsync(credit); notes.Add(string.Format("updatedby:{0},updatedDate:{1},action:{2}", newAccount.CustomerAccount. AuditInfo.UpdateBy, newAccount.CustomerAccount.AuditInfo.UpdateDate, "AddCreditAsync")); var wishListItemResource = new WishlistResource(_apiContext); wishlist.CustomerAccountId = newAccount.CustomerAccount.Id; var newWishList = await wishListItemResource.CreateWishlistAsync(wishlist); notes.Add(string.Format("updatedby:{0},updatedDate:{1},action:{2}", newAccount.CustomerAccount. AuditInfo.UpdateBy, newAccount.CustomerAccount.AuditInfo.UpdateDate, "CreateWishlistAsync")); var customerSegmentResource = new Mozu.Api.Resources.Commerce.Customer.CustomerSegmentResource(_apiContext); // var segmentAccount = await customerSegmentResource.AddSegmentAccountsAsync() var customerNoteResource = new CustomerNoteResource(_apiContext); foreach (var note in notes) { var newNote = await customerNoteResource.AddAccountNoteAsync( new CustomerNote() { Content = note }, newAccount.CustomerAccount.Id); } return(newAccount); }
protected override async Task <bool> GetDataAsync() { var resource = new WishlistResource(Context); _results = await resource.GetWishlistsAsync(startIndex : StartIndex, pageSize : PageSize, sortBy : SortBy, filter : Filter, q : Q, qLimit : QLimit, responseFields : ResponseFields); TotalCount = _results.TotalCount; PageCount = _results.PageCount; PageSize = _results.PageSize; return(_results.Items != null && _results.Items.Count > 0); }