public void AddExpense(ExpenseDto expense) { expenseRepository.Add(expense.ToExpense()); }
public void UpdateExpense(ExpenseDto expense) { expenseRepository.Update(expense.ToExpense()); }
public ActionResult Manage(ManageExpenseVM modelVm) { try { try { if (ModelState.IsValid) { var modelDto = new ExpenseDto { Id = modelVm.Id, ProjectId = modelVm.ProjectId, Description = modelVm.Description, Amount = modelVm.Amount, ExpenseDate = modelVm.ExpenseDate, Name = modelVm.ExpenseName, Notes = modelVm.Notes }; if (modelVm.Id > 0) { expenseService.UpdateExpense(modelDto); } else { expenseService.AddExpense(modelDto); } } } catch (Exception) { ///TODO:Add exception handler throw; } return RedirectToAction("Index"); } catch { return View(); } }