public ActionResult Import(FormCollection form, HttpPostedFileBase file) { return(ResultToMessagePage(() => { IMethodResult result = ProblemManager.AdminImportProblem(Request, form["filetype"], form["uploadtype"], form["content"], file); if (!result.IsSuccess) { return new Tuple <IMethodResult, String>(result, String.Empty); } Dictionary <Int32, Boolean> importedItems = result.ResultObject as Dictionary <Int32, Boolean>; String successInfo = String.Format("{0} problem(s) have benn successfully imported!", importedItems.Count.ToString()); StringBuilder nodataItems = new StringBuilder(); Int32 nodataCount = 0; foreach (KeyValuePair <Int32, Boolean> pair in importedItems) { if (!pair.Value) { if (nodataCount > 0) { nodataItems.Append(','); } nodataItems.Append(pair.Key.ToString()); nodataCount++; } } if (nodataCount > 0) { successInfo += String.Format("<br/>{0} problem(s) ({1}) have no data or fail to import these data!", nodataCount.ToString(), nodataItems.ToString()); } return new Tuple <IMethodResult, String>(result, successInfo); })); }