public ActionResult SaveExpense(ExpenseVM view) { ModelState.Remove("Id"); if (ModelState.IsValid) { if (view.Id == 0) { _expenseRepository.AddToDatabase(view.MapToModel()); TempData["expenseCreatedOrUpdatedMessage"] = "Expense successfully created!"; } else { _expenseRepository.UpdateInDatabase(view.MapToModel(), view.Id); TempData["expenseCreatedOrUpdatedMessage"] = "Expense successfully updated!"; } _expenseRepository.Save(); // calculate ExchangeRate for ExpenseSum if neccessary var travelReport = _travelReportRepository.FindById(view.TravelReportId).MapToView(); var country = _countryAllowanceRepository .GetAllFromDatabaseEnumerable() .Where(c => c.Id == travelReport.CountryAllowanceId) .SingleOrDefault() .MapToView(); travelReport.ExpenseSum = 0; CalculateExpenseSum(travelReport); } return(RedirectToAction("Edit/" + view.TravelReportId)); }