public ActionResult Analysis() { TransactionAnalysisViewModel transactionAnalysisViewModel; using (expenseRepository) { DataSet lookUpData = expenseRepository.GetAnalysisLookUps(); transactionAnalysisViewModel = new TransactionAnalysisViewModel { Users = lookUpData.Tables[0].AsEnumerable().Select(result => new SelectListItem { Text = result.Field <string>("DisplayName"), Value = result.Field <string>("UserId") }), Groups = lookUpData.Tables[1].AsEnumerable().Select(result => new SelectListItem { Text = result.Field <string>("GroupName"), Value = result.Field <int>("GroupId").ToString() }), Expenses = lookUpData.Tables[2].AsEnumerable().Select(result => new SelectListItem { Text = result.Field <string>("Description"), Value = result.Field <int>("ExpenseId").ToString() }) }; } return(View("Analysis", transactionAnalysisViewModel)); }
public string Analysis(TransactionAnalysisViewModel transactionAnalysisViewModel) { AnalysisQuery analysisQuery = Mapper.Map <TransactionAnalysisViewModel, AnalysisQuery>(transactionAnalysisViewModel); DataSet analysisResult = expenseRepository.GetAnalysisData(analysisQuery); if (analysisResult.Tables[0].Rows.Count > 0) { return(analysisResult.Tables[0].Rows[0].Field <decimal>("TotalAmountInReturn").GetDefaultValueIfNull <string>("0")); } return(string.Format("{0:N2}", default(float))); // return PartialView(""); }