예제 #1
0
        public JsonResult LoadUploadsJS(DTParameters param)
        {
            try
            {
                var dtSource = ExtractViewModel.GetExtracts(_unitOfWork);

                List <ExtractViewModel> data = new ResultSet_Extracts().GetResult(param.Search.Value, param.SortOrder, param.Start, param.Length, dtSource, null);
                int count = new ResultSet_Extracts().Count(param.Search.Value, dtSource, null);

                DTResult <ExtractViewModel> result = new DTResult <ExtractViewModel>
                {
                    draw            = param.Draw,
                    data            = data,
                    recordsFiltered = count,
                    recordsTotal    = count
                };

                return(Json(result));
            }
            catch (Exception ex)
            {
                ErrorTools.HandleError(ex, ErrorLevel.NonFatal);    //just log, no redirect
                return(Json(new { error = ex.Message }));
            }
        }
예제 #2
0
        public ActionResult ExportUploads()
        {
            string fileName = "OptimumRCM_Audits.csv";
            var    uploads  = ExtractViewModel.GetExtracts(_unitOfWork)
                              .Select(a => new
            {
                InternalUser = a.InternalUserId,
                a.Name,
                a.DateAdded
            })
                              .OrderBy(a => a.Name)
                              .ToList();

            MemoryStream csvStream = Utility.GenerateCsvStream(fileName, uploads);

            return(File(csvStream, "text/csv", fileName));
        }