Example #1
0
        public IHttpActionResult GetVPAmbientWithID([FromUri] int VPAmbientID, [FromUri] string lang = "en", [FromUri] string extra = "")
        {
            using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
            {
                VPAmbientService vpAmbientService = new VPAmbientService(new Query()
                {
                    Language = (lang == "fr" ? LanguageEnum.fr : LanguageEnum.en)
                }, db, ContactID);

                vpAmbientService.Query = vpAmbientService.FillQuery(typeof(VPAmbient), lang, 0, 1, "", "", extra);

                if (vpAmbientService.Query.Extra == "A")
                {
                    VPAmbientExtraA vpAmbientExtraA = new VPAmbientExtraA();
                    vpAmbientExtraA = vpAmbientService.GetVPAmbientExtraAWithVPAmbientID(VPAmbientID);

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

                    return(Ok(vpAmbientExtraA));
                }
                else if (vpAmbientService.Query.Extra == "B")
                {
                    VPAmbientExtraB vpAmbientExtraB = new VPAmbientExtraB();
                    vpAmbientExtraB = vpAmbientService.GetVPAmbientExtraBWithVPAmbientID(VPAmbientID);

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

                    return(Ok(vpAmbientExtraB));
                }
                else
                {
                    VPAmbient vpAmbient = new VPAmbient();
                    vpAmbient = vpAmbientService.GetVPAmbientWithVPAmbientID(VPAmbientID);

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

                    return(Ok(vpAmbient));
                }
            }
        }
Example #2
0
 public VPAmbientTest()
 {
     vPAmbient       = new VPAmbient();
     vPAmbientExtraA = new VPAmbientExtraA();
     vPAmbientExtraB = new VPAmbientExtraB();
 }