private BudgetAllocationEntity ToEntity(BudgetAllocation budgetAllocation) { return(new BudgetAllocationEntity() { Id = budgetAllocation.Id, BudgetId = budgetAllocation.BudgetId, Amount = budgetAllocation.Amount, Approved = budgetAllocation.Approved, ApprovedById = budgetAllocation.ApprovedById, ApprovedDate = budgetAllocation.ApprovedDate, UpdatedById = budgetAllocation.UpdatedById, UpdatedDate = DateTime.Now }); }
public BudgetResponse IncreaseBudgetAllocation(BudgetRequest budgetRequest) { BudgetAllocation allocation = budgetRequest.BudgetAllocations.FirstOrDefault(); if (allocation.Approved == Constants.BUDGET_APPROVED) { allocation.ApprovedById = budgetRequest.UpdatedById; allocation.ApprovedDate = DateTime.Now; } allocation.UpdatedById = budgetRequest.UpdatedById; allocation.UpdatedDate = DateTime.Now; var updated = _spendBudgetDataProvider.IncreaseBudgetAllocation(ToEntity(budgetRequest)); return(ToModel(updated)); }