Exemple #1
0
        public IHttpActionResult GetEmailDistributionListContactLanguageWithID([FromUri] int EmailDistributionListContactLanguageID, [FromUri] string lang = "en", [FromUri] string extra = "")
        {
            using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
            {
                EmailDistributionListContactLanguageService emailDistributionListContactLanguageService = new EmailDistributionListContactLanguageService(new Query()
                {
                    Language = (lang == "fr" ? LanguageEnum.fr : LanguageEnum.en)
                }, db, ContactID);

                emailDistributionListContactLanguageService.Query = emailDistributionListContactLanguageService.FillQuery(typeof(EmailDistributionListContactLanguage), lang, 0, 1, "", "", extra);

                if (emailDistributionListContactLanguageService.Query.Extra == "A")
                {
                    EmailDistributionListContactLanguageExtraA emailDistributionListContactLanguageExtraA = new EmailDistributionListContactLanguageExtraA();
                    emailDistributionListContactLanguageExtraA = emailDistributionListContactLanguageService.GetEmailDistributionListContactLanguageExtraAWithEmailDistributionListContactLanguageID(EmailDistributionListContactLanguageID);

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

                    return(Ok(emailDistributionListContactLanguageExtraA));
                }
                else if (emailDistributionListContactLanguageService.Query.Extra == "B")
                {
                    EmailDistributionListContactLanguageExtraB emailDistributionListContactLanguageExtraB = new EmailDistributionListContactLanguageExtraB();
                    emailDistributionListContactLanguageExtraB = emailDistributionListContactLanguageService.GetEmailDistributionListContactLanguageExtraBWithEmailDistributionListContactLanguageID(EmailDistributionListContactLanguageID);

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

                    return(Ok(emailDistributionListContactLanguageExtraB));
                }
                else
                {
                    EmailDistributionListContactLanguage emailDistributionListContactLanguage = new EmailDistributionListContactLanguage();
                    emailDistributionListContactLanguage = emailDistributionListContactLanguageService.GetEmailDistributionListContactLanguageWithEmailDistributionListContactLanguageID(EmailDistributionListContactLanguageID);

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

                    return(Ok(emailDistributionListContactLanguage));
                }
            }
        }
 public EmailDistributionListContactLanguageTest()
 {
     emailDistributionListContactLanguage       = new EmailDistributionListContactLanguage();
     emailDistributionListContactLanguageExtraA = new EmailDistributionListContactLanguageExtraA();
     emailDistributionListContactLanguageExtraB = new EmailDistributionListContactLanguageExtraB();
 }