Exemple #1
0
        public ExpenseUpdateAccountUpdateModel Edit(ExpenseAddModel model)
        {
            var expense = Find(model.ExpenseId);

            if (expense == null)
            {
                return(null);
            }

            var returnModel = new ExpenseUpdateAccountUpdateModel
            {
                IsApproved       = expense.IsApproved,
                PrevAmount       = expense.ExpenseAmount,
                CurrentAmount    = model.ExpenseAmount,
                PrevAccountId    = expense.AccountId,
                CurrentAccountId = model.AccountId
            };

            expense.ExpenseDate       = model.ExpenseDate;
            expense.ExpenseAmount     = model.ExpenseAmount;
            expense.ExpenseCategoryId = model.ExpenseCategoryId;
            expense.ExpenseFor        = model.ExpenseFor;
            Update(expense);

            return(returnModel);
        }
Exemple #2
0
 public void AddCustom(ExpenseAddModel model, int registrationId, int voucherNo, bool isApproved)
 {
     Add(new Expense
     {
         RegistrationId    = registrationId,
         ExpenseCategoryId = model.ExpenseCategoryId,
         ExpenseAmount     = model.ExpenseAmount,
         ExpenseFor        = model.ExpenseFor,
         ExpenseDate       = model.ExpenseDate,
         VoucherNo         = voucherNo,
         IsApproved        = isApproved,
         AccountId         = model.AccountId
     });
 }