public IHttpActionResult GetReportSectionLanguageWithID([FromUri] int ReportSectionLanguageID, [FromUri] string lang = "en", [FromUri] string extra = "") { using (CSSPDBContext db = new CSSPDBContext(DatabaseType)) { ReportSectionLanguageService reportSectionLanguageService = new ReportSectionLanguageService(new Query() { Language = (lang == "fr" ? LanguageEnum.fr : LanguageEnum.en) }, db, ContactID); reportSectionLanguageService.Query = reportSectionLanguageService.FillQuery(typeof(ReportSectionLanguage), lang, 0, 1, "", "", extra); if (reportSectionLanguageService.Query.Extra == "A") { ReportSectionLanguageExtraA reportSectionLanguageExtraA = new ReportSectionLanguageExtraA(); reportSectionLanguageExtraA = reportSectionLanguageService.GetReportSectionLanguageExtraAWithReportSectionLanguageID(ReportSectionLanguageID); if (reportSectionLanguageExtraA == null) { return(NotFound()); } return(Ok(reportSectionLanguageExtraA)); } else if (reportSectionLanguageService.Query.Extra == "B") { ReportSectionLanguageExtraB reportSectionLanguageExtraB = new ReportSectionLanguageExtraB(); reportSectionLanguageExtraB = reportSectionLanguageService.GetReportSectionLanguageExtraBWithReportSectionLanguageID(ReportSectionLanguageID); if (reportSectionLanguageExtraB == null) { return(NotFound()); } return(Ok(reportSectionLanguageExtraB)); } else { ReportSectionLanguage reportSectionLanguage = new ReportSectionLanguage(); reportSectionLanguage = reportSectionLanguageService.GetReportSectionLanguageWithReportSectionLanguageID(ReportSectionLanguageID); if (reportSectionLanguage == null) { return(NotFound()); } return(Ok(reportSectionLanguage)); } } }
public ReportSectionLanguageTest() { reportSectionLanguage = new ReportSectionLanguage(); reportSectionLanguageExtraA = new ReportSectionLanguageExtraA(); reportSectionLanguageExtraB = new ReportSectionLanguageExtraB(); }