public IHttpActionResult GetInfrastructureLanguageWithID([FromUri] int InfrastructureLanguageID, [FromUri] string lang = "en", [FromUri] string extra = "") { using (CSSPDBContext db = new CSSPDBContext(DatabaseType)) { InfrastructureLanguageService infrastructureLanguageService = new InfrastructureLanguageService(new Query() { Language = (lang == "fr" ? LanguageEnum.fr : LanguageEnum.en) }, db, ContactID); infrastructureLanguageService.Query = infrastructureLanguageService.FillQuery(typeof(InfrastructureLanguage), lang, 0, 1, "", "", extra); if (infrastructureLanguageService.Query.Extra == "A") { InfrastructureLanguageExtraA infrastructureLanguageExtraA = new InfrastructureLanguageExtraA(); infrastructureLanguageExtraA = infrastructureLanguageService.GetInfrastructureLanguageExtraAWithInfrastructureLanguageID(InfrastructureLanguageID); if (infrastructureLanguageExtraA == null) { return(NotFound()); } return(Ok(infrastructureLanguageExtraA)); } else if (infrastructureLanguageService.Query.Extra == "B") { InfrastructureLanguageExtraB infrastructureLanguageExtraB = new InfrastructureLanguageExtraB(); infrastructureLanguageExtraB = infrastructureLanguageService.GetInfrastructureLanguageExtraBWithInfrastructureLanguageID(InfrastructureLanguageID); if (infrastructureLanguageExtraB == null) { return(NotFound()); } return(Ok(infrastructureLanguageExtraB)); } else { InfrastructureLanguage infrastructureLanguage = new InfrastructureLanguage(); infrastructureLanguage = infrastructureLanguageService.GetInfrastructureLanguageWithInfrastructureLanguageID(InfrastructureLanguageID); if (infrastructureLanguage == null) { return(NotFound()); } return(Ok(infrastructureLanguage)); } } }
public InfrastructureLanguageTest() { infrastructureLanguage = new InfrastructureLanguage(); infrastructureLanguageExtraA = new InfrastructureLanguageExtraA(); infrastructureLanguageExtraB = new InfrastructureLanguageExtraB(); }