public IHttpActionResult GetMWQMRunWithID([FromUri] int MWQMRunID, [FromUri] string lang = "en", [FromUri] string extra = "")
        {
            using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
            {
                MWQMRunService mwqmRunService = new MWQMRunService(new Query()
                {
                    Language = (lang == "fr" ? LanguageEnum.fr : LanguageEnum.en)
                }, db, ContactID);

                mwqmRunService.Query = mwqmRunService.FillQuery(typeof(MWQMRun), lang, 0, 1, "", "", extra);

                if (mwqmRunService.Query.Extra == "A")
                {
                    MWQMRunExtraA mwqmRunExtraA = new MWQMRunExtraA();
                    mwqmRunExtraA = mwqmRunService.GetMWQMRunExtraAWithMWQMRunID(MWQMRunID);

                    if (mwqmRunExtraA == null)
                    {
                        return(NotFound());
                    }

                    return(Ok(mwqmRunExtraA));
                }
                else if (mwqmRunService.Query.Extra == "B")
                {
                    MWQMRunExtraB mwqmRunExtraB = new MWQMRunExtraB();
                    mwqmRunExtraB = mwqmRunService.GetMWQMRunExtraBWithMWQMRunID(MWQMRunID);

                    if (mwqmRunExtraB == null)
                    {
                        return(NotFound());
                    }

                    return(Ok(mwqmRunExtraB));
                }
                else
                {
                    MWQMRun mwqmRun = new MWQMRun();
                    mwqmRun = mwqmRunService.GetMWQMRunWithMWQMRunID(MWQMRunID);

                    if (mwqmRun == null)
                    {
                        return(NotFound());
                    }

                    return(Ok(mwqmRun));
                }
            }
        }
示例#2
0
 public MWQMRunTest()
 {
     mWQMRun       = new MWQMRun();
     mWQMRunExtraA = new MWQMRunExtraA();
     mWQMRunExtraB = new MWQMRunExtraB();
 }