public ActionResult Import(TableModels model) { try { if (model.ListStores == null) { ModelState.AddModelError("ListStores", _AttributeForLanguage.CurrentUser.GetLanguageTextFromKey("Please choose store")); return(View(model)); } if (model.ExcelUpload == null || model.ExcelUpload.ContentLength <= 0) { ModelState.AddModelError("ExcelUpload", _AttributeForLanguage.CurrentUser.GetLanguageTextFromKey("Excel filename cannot be null")); return(View(model)); } ImportModel importModel = new ImportModel(); string msg = ""; StatusResponse response = _factory.Import(model.ExcelUpload, model.ListStores, ref importModel, ref msg); if (!response.Status) { ModelState.AddModelError("", response.MsgError); return(View(model)); } // Delete File Excel and File Zip Image CommonHelper.DeleteFileFromServer(CommonHelper.GetFilePath(model.ExcelUpload)); //if (!ModelState.IsValid) // return View(model); if (msg.Equals("")) { return(View("ImportDetail", importModel)); } else { _logger.Error("Table_Import: " + msg); ModelState.AddModelError("ImageZipUpload", msg); return(View(model)); } } catch (Exception e) { _logger.Error("Table_Import : " + e); //return new HttpStatusCodeResult(400, e.Message); ModelState.AddModelError("ExcelUpload", _AttributeForLanguage.CurrentUser.GetLanguageTextFromKey("Import file have error")); return(View(model)); } }