public ActionResult GetExpensesForCategory(string userName, string category) { if (ModelState.IsValid) { ExpenseItem[] results; if (string.IsNullOrEmpty(category)) { results = ExpenseManager.GetExpenseItems(userName); } else { results = ExpenseManager.GetExpenseItemsByCategory(userName, category); } return(Json(results, JsonRequestBehavior.AllowGet)); } else { return(new HttpStatusCodeResult(HttpStatusCode.NotFound)); } }