public ActionResult Expense() { Expense ex = new Models.Expense(); Exp_Cat ec = new Models.Exp_Cat(); ViewBag.ec = ec.all(); if (TempData["type"] != null) { if (TempData["type"] == "ecid") { ex.EC_Name = TempData["value"].ToString(); ec.searchbyname(); return(View(ex.expensebyecid())); } else { ex.Name = (string)TempData["value"]; return(View(ex.expbyname())); } } return(View(ex.all())); }