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

                telService.Query = telService.FillQuery(typeof(Tel), lang, 0, 1, "", "", extra);

                if (telService.Query.Extra == "A")
                {
                    TelExtraA telExtraA = new TelExtraA();
                    telExtraA = telService.GetTelExtraAWithTelID(TelID);

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

                    return(Ok(telExtraA));
                }
                else if (telService.Query.Extra == "B")
                {
                    TelExtraB telExtraB = new TelExtraB();
                    telExtraB = telService.GetTelExtraBWithTelID(TelID);

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

                    return(Ok(telExtraB));
                }
                else
                {
                    Tel tel = new Tel();
                    tel = telService.GetTelWithTelID(TelID);

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

                    return(Ok(tel));
                }
            }
        }
コード例 #2
0
 public TelTest()
 {
     tel       = new Tel();
     telExtraA = new TelExtraA();
     telExtraB = new TelExtraB();
 }