Exemplo n.º 1
0
        public IHttpActionResult GetSamplingPlanSubsectorSiteWithID([FromUri] int SamplingPlanSubsectorSiteID, [FromUri] string lang = "en", [FromUri] string extra = "")
        {
            using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
            {
                SamplingPlanSubsectorSiteService samplingPlanSubsectorSiteService = new SamplingPlanSubsectorSiteService(new Query()
                {
                    Language = (lang == "fr" ? LanguageEnum.fr : LanguageEnum.en)
                }, db, ContactID);

                samplingPlanSubsectorSiteService.Query = samplingPlanSubsectorSiteService.FillQuery(typeof(SamplingPlanSubsectorSite), lang, 0, 1, "", "", extra);

                if (samplingPlanSubsectorSiteService.Query.Extra == "A")
                {
                    SamplingPlanSubsectorSiteExtraA samplingPlanSubsectorSiteExtraA = new SamplingPlanSubsectorSiteExtraA();
                    samplingPlanSubsectorSiteExtraA = samplingPlanSubsectorSiteService.GetSamplingPlanSubsectorSiteExtraAWithSamplingPlanSubsectorSiteID(SamplingPlanSubsectorSiteID);

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

                    return(Ok(samplingPlanSubsectorSiteExtraA));
                }
                else if (samplingPlanSubsectorSiteService.Query.Extra == "B")
                {
                    SamplingPlanSubsectorSiteExtraB samplingPlanSubsectorSiteExtraB = new SamplingPlanSubsectorSiteExtraB();
                    samplingPlanSubsectorSiteExtraB = samplingPlanSubsectorSiteService.GetSamplingPlanSubsectorSiteExtraBWithSamplingPlanSubsectorSiteID(SamplingPlanSubsectorSiteID);

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

                    return(Ok(samplingPlanSubsectorSiteExtraB));
                }
                else
                {
                    SamplingPlanSubsectorSite samplingPlanSubsectorSite = new SamplingPlanSubsectorSite();
                    samplingPlanSubsectorSite = samplingPlanSubsectorSiteService.GetSamplingPlanSubsectorSiteWithSamplingPlanSubsectorSiteID(SamplingPlanSubsectorSiteID);

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

                    return(Ok(samplingPlanSubsectorSite));
                }
            }
        }
 public SamplingPlanSubsectorSiteTest()
 {
     samplingPlanSubsectorSite       = new SamplingPlanSubsectorSite();
     samplingPlanSubsectorSiteExtraA = new SamplingPlanSubsectorSiteExtraA();
     samplingPlanSubsectorSiteExtraB = new SamplingPlanSubsectorSiteExtraB();
 }