コード例 #1
0
        public IHttpActionResult GetMWQMSampleLanguageWithID([FromUri] int MWQMSampleLanguageID, [FromUri] string lang = "en", [FromUri] string extra = "")
        {
            using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
            {
                MWQMSampleLanguageService mwqmSampleLanguageService = new MWQMSampleLanguageService(new Query()
                {
                    Language = (lang == "fr" ? LanguageEnum.fr : LanguageEnum.en)
                }, db, ContactID);

                mwqmSampleLanguageService.Query = mwqmSampleLanguageService.FillQuery(typeof(MWQMSampleLanguage), lang, 0, 1, "", "", extra);

                if (mwqmSampleLanguageService.Query.Extra == "A")
                {
                    MWQMSampleLanguageExtraA mwqmSampleLanguageExtraA = new MWQMSampleLanguageExtraA();
                    mwqmSampleLanguageExtraA = mwqmSampleLanguageService.GetMWQMSampleLanguageExtraAWithMWQMSampleLanguageID(MWQMSampleLanguageID);

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

                    return(Ok(mwqmSampleLanguageExtraA));
                }
                else if (mwqmSampleLanguageService.Query.Extra == "B")
                {
                    MWQMSampleLanguageExtraB mwqmSampleLanguageExtraB = new MWQMSampleLanguageExtraB();
                    mwqmSampleLanguageExtraB = mwqmSampleLanguageService.GetMWQMSampleLanguageExtraBWithMWQMSampleLanguageID(MWQMSampleLanguageID);

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

                    return(Ok(mwqmSampleLanguageExtraB));
                }
                else
                {
                    MWQMSampleLanguage mwqmSampleLanguage = new MWQMSampleLanguage();
                    mwqmSampleLanguage = mwqmSampleLanguageService.GetMWQMSampleLanguageWithMWQMSampleLanguageID(MWQMSampleLanguageID);

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

                    return(Ok(mwqmSampleLanguage));
                }
            }
        }
コード例 #2
0
 public MWQMSampleLanguageTest()
 {
     mWQMSampleLanguage       = new MWQMSampleLanguage();
     mWQMSampleLanguageExtraA = new MWQMSampleLanguageExtraA();
     mWQMSampleLanguageExtraB = new MWQMSampleLanguageExtraB();
 }