public virtual ActionResult ExportOutExcelSelected(string selectedIds) { if (!User.Identity.IsAuthenticated) { return(AccessDeniedView()); } var docs = new List <OutStandingDoc>(); if (selectedIds != null) { var ids = selectedIds .Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries) .Select(x => Convert.ToInt32(x)) .ToArray(); docs.AddRange(_dqQueService.GetOutDocItembyIds(ids)); } try { byte[] bytes = _exportManager.ExportOutDocumentsToXlsx(docs); identity = ((CustomPrincipal)User).CustomIdentity; _messagingService.SaveUserActivity(identity.ProfileId, "Downloaded Customers With Outstanding Documents Report", DateTime.Now); return(File(bytes, MimeTypes.TextXlsx, "outstandingDocs.xlsx")); } catch (Exception exc) { ErrorNotification(exc); return(RedirectToAction("List")); } }