public ActionResult WriteData(BoughtListViewModel input) { BoughtListViewModel BoutListView = new BoughtListViewModel(); if (ModelState.IsValid) { var flag = ABS.WtrieData(input.InputData); if (flag != true) { BoutListView.InputData.Remark = "出錯啦!!!!"; } BoutListView.Result = ABS.GetAllData(); BoutListView.InputData = new BoughtItem(); return(PartialView("BoughtListGridPartialView", BoutListView)); } TempData["ErrorPage"] = input; TempData["ModelState"] = ModelState; return(JavaScript($"window.location = '{Url.Action("BoughtList")}'")); }