public IHttpActionResult GetMWQMSampleWithID([FromUri] int MWQMSampleID, [FromUri] string lang = "en", [FromUri] string extra = "") { using (CSSPDBContext db = new CSSPDBContext(DatabaseType)) { MWQMSampleService mwqmSampleService = new MWQMSampleService(new Query() { Language = (lang == "fr" ? LanguageEnum.fr : LanguageEnum.en) }, db, ContactID); mwqmSampleService.Query = mwqmSampleService.FillQuery(typeof(MWQMSample), lang, 0, 1, "", "", extra); if (mwqmSampleService.Query.Extra == "A") { MWQMSampleExtraA mwqmSampleExtraA = new MWQMSampleExtraA(); mwqmSampleExtraA = mwqmSampleService.GetMWQMSampleExtraAWithMWQMSampleID(MWQMSampleID); if (mwqmSampleExtraA == null) { return(NotFound()); } return(Ok(mwqmSampleExtraA)); } else if (mwqmSampleService.Query.Extra == "B") { MWQMSampleExtraB mwqmSampleExtraB = new MWQMSampleExtraB(); mwqmSampleExtraB = mwqmSampleService.GetMWQMSampleExtraBWithMWQMSampleID(MWQMSampleID); if (mwqmSampleExtraB == null) { return(NotFound()); } return(Ok(mwqmSampleExtraB)); } else { MWQMSample mwqmSample = new MWQMSample(); mwqmSample = mwqmSampleService.GetMWQMSampleWithMWQMSampleID(MWQMSampleID); if (mwqmSample == null) { return(NotFound()); } return(Ok(mwqmSample)); } } }
public MWQMSampleTest() { mWQMSample = new MWQMSample(); mWQMSampleExtraA = new MWQMSampleExtraA(); mWQMSampleExtraB = new MWQMSampleExtraB(); }