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)); } } }
public TelTest() { tel = new Tel(); telExtraA = new TelExtraA(); telExtraB = new TelExtraB(); }