public IHttpActionResult GetReportTypeWithID([FromUri] int ReportTypeID, [FromUri] string lang = "en", [FromUri] string extra = "") { using (CSSPDBContext db = new CSSPDBContext(DatabaseType)) { ReportTypeService reportTypeService = new ReportTypeService(new Query() { Language = (lang == "fr" ? LanguageEnum.fr : LanguageEnum.en) }, db, ContactID); reportTypeService.Query = reportTypeService.FillQuery(typeof(ReportType), lang, 0, 1, "", "", extra); if (reportTypeService.Query.Extra == "A") { ReportTypeExtraA reportTypeExtraA = new ReportTypeExtraA(); reportTypeExtraA = reportTypeService.GetReportTypeExtraAWithReportTypeID(ReportTypeID); if (reportTypeExtraA == null) { return(NotFound()); } return(Ok(reportTypeExtraA)); } else if (reportTypeService.Query.Extra == "B") { ReportTypeExtraB reportTypeExtraB = new ReportTypeExtraB(); reportTypeExtraB = reportTypeService.GetReportTypeExtraBWithReportTypeID(ReportTypeID); if (reportTypeExtraB == null) { return(NotFound()); } return(Ok(reportTypeExtraB)); } else { ReportType reportType = new ReportType(); reportType = reportTypeService.GetReportTypeWithReportTypeID(ReportTypeID); if (reportType == null) { return(NotFound()); } return(Ok(reportType)); } } }
public ReportTypeTest() { reportType = new ReportType(); reportTypeExtraA = new ReportTypeExtraA(); reportTypeExtraB = new ReportTypeExtraB(); }