public IActionResult GetReportByTrainingProgramWithTrainingFilter([FromBody] TrainingFilterViewModel TrainingFilter) { string error = ""; try { if (TrainingFilter != null) { var hasData = this.repositoryReport.GetReportByTrainingProgramWithTrainingFilter(TrainingFilter); //(TrainingFilter.TrainingId, //string.IsNullOrEmpty(TrainingFilter.GroupCode) ? null : new List<string>() { TrainingFilter.GroupCode }, //string.IsNullOrEmpty(TrainingFilter.PositionCode) ? null : new List<string>() { TrainingFilter.PositionCode }, //TrainingFilter.LocateID); string imagePath = this.appEnvironment.WebRootPath + "\\images\\logoVIPCO.png"; if (hasData.Item1.Any()) { var stream = new ReportClasses.Report().CreateExcelDoc(hasData.Item1, imagePath, hasData.Item2); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "Reports.xlsx")); } } } catch (Exception ex) { error = ex.ToString(); } return(NotFound(new { Error = "Training Program report not found " + error })); }
public IActionResult GetReportByTrainingProgramWithGroupAndPosition(int id, string group, string position) { string error = ""; try { var hasData = this.repositoryReport.GetReportByTrainingProgramWithGroupV2(id, new List <string> { group }, new List <string> { position }); string imagePath = this.appEnvironment.WebRootPath + "\\images\\logoVIPCO.png"; if (hasData.Any()) { var stream = new ReportClasses.Report().CreateExcelDoc(hasData, imagePath); stream.Seek(0, SeekOrigin.Begin); return(File(stream, "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", "Reports.xlsx")); } } catch (Exception ex) { error = ex.ToString(); } return(NotFound(new { Error = "Training Program report not found " + error })); }