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

                tvItemLanguageService.Query = tvItemLanguageService.FillQuery(typeof(TVItemLanguage), lang, 0, 1, "", "", extra);

                if (tvItemLanguageService.Query.Extra == "A")
                {
                    TVItemLanguageExtraA tvItemLanguageExtraA = new TVItemLanguageExtraA();
                    tvItemLanguageExtraA = tvItemLanguageService.GetTVItemLanguageExtraAWithTVItemLanguageID(TVItemLanguageID);

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

                    return(Ok(tvItemLanguageExtraA));
                }
                else if (tvItemLanguageService.Query.Extra == "B")
                {
                    TVItemLanguageExtraB tvItemLanguageExtraB = new TVItemLanguageExtraB();
                    tvItemLanguageExtraB = tvItemLanguageService.GetTVItemLanguageExtraBWithTVItemLanguageID(TVItemLanguageID);

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

                    return(Ok(tvItemLanguageExtraB));
                }
                else
                {
                    TVItemLanguage tvItemLanguage = new TVItemLanguage();
                    tvItemLanguage = tvItemLanguageService.GetTVItemLanguageWithTVItemLanguageID(TVItemLanguageID);

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

                    return(Ok(tvItemLanguage));
                }
            }
        }
コード例 #2
0
 public TVItemLanguageTest()
 {
     tVItemLanguage       = new TVItemLanguage();
     tVItemLanguageExtraA = new TVItemLanguageExtraA();
     tVItemLanguageExtraB = new TVItemLanguageExtraB();
 }