public IHttpActionResult GetReportSectionWithID([FromUri] int ReportSectionID, [FromUri] string lang = "en", [FromUri] string extra = "") { using (CSSPDBContext db = new CSSPDBContext(DatabaseType)) { ReportSectionService reportSectionService = new ReportSectionService(new Query() { Language = (lang == "fr" ? LanguageEnum.fr : LanguageEnum.en) }, db, ContactID); reportSectionService.Query = reportSectionService.FillQuery(typeof(ReportSection), lang, 0, 1, "", "", extra); if (reportSectionService.Query.Extra == "A") { ReportSectionExtraA reportSectionExtraA = new ReportSectionExtraA(); reportSectionExtraA = reportSectionService.GetReportSectionExtraAWithReportSectionID(ReportSectionID); if (reportSectionExtraA == null) { return(NotFound()); } return(Ok(reportSectionExtraA)); } else if (reportSectionService.Query.Extra == "B") { ReportSectionExtraB reportSectionExtraB = new ReportSectionExtraB(); reportSectionExtraB = reportSectionService.GetReportSectionExtraBWithReportSectionID(ReportSectionID); if (reportSectionExtraB == null) { return(NotFound()); } return(Ok(reportSectionExtraB)); } else { ReportSection reportSection = new ReportSection(); reportSection = reportSectionService.GetReportSectionWithReportSectionID(ReportSectionID); if (reportSection == null) { return(NotFound()); } return(Ok(reportSection)); } } }
public ReportSectionTest() { reportSection = new ReportSection(); reportSectionExtraA = new ReportSectionExtraA(); reportSectionExtraB = new ReportSectionExtraB(); }