public ActionResult Index(int categoryId, string expenseName = "") { List <ExpenseReportModel> expenses = new List <ExpenseReportModel>(); var userId = userManager.GetUserId(User); if (string.IsNullOrEmpty(expenseName)) { expenseName = ""; } expenses = _expenseReportService.GetSearchExpenseResult(categoryId, expenseName, userId).ToList(); ViewBag.ListOfCategories = _categoryService.GetAllCategories(); foreach (var item in expenses) { item.PaymentType = _paymentTypeService.GetPaymentTypeById(item.PaymentTypeId); } foreach (var item in expenses) { item.Category = _categoryService.GetCategoryById(item.CategoryId); } return(View(expenses)); }