public ActionResult ShipmentAnalysisReport(Guid bolId) { var operationResult = new OperationResult(); MemoryStream ms = new MemoryStream(); var _billOfLadingRepository = new BillOfLadingRepository(); try { ms = ReportingManager.CreateShipmentAnalysisReport(bolId); if (ms != null) { var existingBillOfLading = _billOfLadingRepository.GetBillOfLading(bolId); existingBillOfLading.HasBeenAnalyzed = true; operationResult = _billOfLadingRepository.UpdateBillOfLading(existingBillOfLading); } } catch (Exception ex) { operationResult.Message = "Error occured during Shipment Analysis"; logger.ErrorFormat("Error occured during Shipment Analysis: {0} ", ex.ToString()); this.AddNotification(operationResult.Message, NotificationType.ERROR); } return(new FileStreamResult(ms, "application/pdf")); }