コード例 #1
0
 /// <summary>
 /// Updates the values of a Splitwise transaction with the values from an expense.
 /// </summary>
 /// <param name="entity">The Splitwise transaction entity to be updated.</param>
 /// <param name="expense">The expense.</param>
 public static void UpdateValues(this SplitwiseTransactionEntity entity, SW.Expense expense)
 {
     entity.Id             = expense.Id;
     entity.Date           = expense.Date;
     entity.Description    = expense.Description;
     entity.IsDeleted      = expense.IsDeleted;
     entity.UpdatedAt      = expense.UpdatedAt;
     entity.PaidAmount     = expense.PaidAmount;
     entity.PersonalAmount = expense.PersonalAmount;
     entity.Imported       = false;
 }
コード例 #2
0
 /// <summary>
 /// Converts an expense from Splitwise to a Splitwise transaction entity.
 /// </summary>
 /// <param name="expense">The expense.</param>
 /// <returns>The created entity.</returns>
 public static SplitwiseTransactionEntity ToSplitwiseTransactionEntity(this SW.Expense expense)
 {
     return(new SplitwiseTransactionEntity
     {
         Id = expense.Id,
         Date = expense.Date,
         Description = expense.Description,
         Imported = false,
         IsDeleted = expense.IsDeleted,
         PaidAmount = expense.PaidAmount,
         PersonalAmount = expense.PersonalAmount,
         UpdatedAt = expense.UpdatedAt,
         SplitDetails = expense.Splits.Select(s => s.ToSplitDetailEntity()).ToList(),
     });
 }