public JsonResult ImportExcel() { var list = new List <EnquiryError>(); if (Request.Files.Count > 0) { HttpPostedFileBase postedFileBase = Request.Files[0]; string fileName = postedFileBase.FileName; byte[] buffer = new byte[postedFileBase.ContentLength]; postedFileBase.InputStream.Read(buffer, 0, postedFileBase.ContentLength); DataTable dt = ConvertExcelToDataTable(buffer, fileName); var importList = ConvertDataTableToGenericList(dt); string xmlString = ConvertToXmlString(importList); if (xmlString != string.Empty) { var errorMessage = manager.ImportEnquiry(xmlString, (int)Session["UserId"]); if (errorMessage != string.Empty) { UTF8Encoding encoding = new UTF8Encoding(); XmlSerializer xs = new XmlSerializer(typeof(List <EnquiryError>), new XmlRootAttribute("ArrayOfEnquiryError")); MemoryStream memoryStream = new MemoryStream(encoding.GetBytes(errorMessage)); list = (List <EnquiryError>)xs.Deserialize(memoryStream); } } if (list.Count > 0) { RedisCacheHelper.ClearAllCacheData("Enquiry_"); } } return(Json(list.OrderBy(o => o.RowNumber), JsonRequestBehavior.AllowGet)); }