/// <summary> /// To the one time expense domain object. /// </summary> /// <param name="expense">The expense.</param> /// <returns></returns> public static OneTimeExpense ToOneTimeExpenseDomainObject(this ExpenseContract expense) { return(null == expense ? null : new OneTimeExpense() { UserId = expense.LessonUserId, Value = expense.ExpenseAmount, Month = expense.ExpenseDate == DateTime.MinValue?0:expense.ExpenseDate.Month, Name = expense.Name, OneTimeExpenseId = expense.Id }); }
/// <summary> /// To the recurring expense domain object. /// </summary> /// <param name="expense">The expense.</param> /// <returns></returns> public static RecurringExpense ToRecurringExpenseDomainObject(this ExpenseContract expense) { return(null == expense ? null : new RecurringExpense() { FrequencyId = expense.FrequencyId, Frequency = expense.Frequency == null?null:expense.Frequency.ToDomainObject(), UserId = expense.LessonUserId, Value = expense.ExpenseAmount, RecurringExpenseId = expense.Id, Name = expense.Name, }); }
/// <summary> /// To the domain object. /// </summary> /// <param name="expense">The expense.</param> /// <returns></returns> public static Expense ToDomainObject(this ExpenseContract expense) { return(new Expense() { FrequencyId = expense.FrequencyId, Frequency = expense.Frequency.ToDomainObject(), UserId = expense.LessonUserId, Complex = expense.HasTopLevelExpense, CreditExpense = expense.PaidByCreditCard, ParentExpenseId = expense.ParentExpenseId, ExpenseId = expense.Id, ParentName = expense.ParentExpenseType, DisplayName = expense.DisplayName, Recurring = expense.HasTopLevelExpense, Value = expense.ExpenseAmount, Name = expense.Name }); }