public ActionResult ExcelImport(HttpPostedFileBase file) { var list = ExcelExportHelper.ImportExcel <FoodMap>(file.InputStream); string msg = ""; foreach (var item in list) { string res = DoMap(item.Token, item.ItemId, item.SpecId, item.ProdNo); if (!string.IsNullOrEmpty(res)) { msg += res; } } if (string.IsNullOrEmpty(msg)) { return(Json(new AjaxResult() { state = "ok" })); } else { return(Json(new AjaxResult() { state = "no", msg = msg })); } }
public async Task <ActionResult> RuleCreate(StockRuleDTO stockRule, HttpPostedFileBase file) { stockRule.UserId = Global.USER_ID; var list = ExcelExportHelper.ImportExcel <StockRuleProdDTO>(file.InputStream); await _stockRuleService.CreateAsync(stockRule, list); return(Json(new AjaxResult() { state = "ok" })); }