public async Task <Account> AddAccountAsync(Account account) { // when create the new book, the createdby and updatedby should be same. var currDateTime = DateTime.Now; account.UpdatedBy = account.CreatedBy; account.CreatedDate = currDateTime; account.UpdatedDate = currDateTime; var result = await MongoDbHelper.AddRecord(collectionName, account).ConfigureAwait(false); return(result); }
public async Task <Book> AddBookAsync(Book book) { // when create the new book, the createdby and updatedby should be same. var currDateTime = DateTime.Now; book.CreatedBy = book.UpdatedBy; book.CreatedDate = currDateTime; book.UpdatedDate = currDateTime; var result = await MongoDbHelper.AddRecord(collectionName, book).ConfigureAwait(false); var currBookId = result.Id; var userName = book.CreatedBy; await ServiceFactory.AuthAccountsServicesInstance.ShareBookToUserAsync(userName, currBookId).ConfigureAwait(false); return(result); }