public IHttpActionResult GetMapInfoWithID([FromUri] int MapInfoID, [FromUri] string lang = "en", [FromUri] string extra = "") { using (CSSPDBContext db = new CSSPDBContext(DatabaseType)) { MapInfoService mapInfoService = new MapInfoService(new Query() { Language = (lang == "fr" ? LanguageEnum.fr : LanguageEnum.en) }, db, ContactID); mapInfoService.Query = mapInfoService.FillQuery(typeof(MapInfo), lang, 0, 1, "", "", extra); if (mapInfoService.Query.Extra == "A") { MapInfoExtraA mapInfoExtraA = new MapInfoExtraA(); mapInfoExtraA = mapInfoService.GetMapInfoExtraAWithMapInfoID(MapInfoID); if (mapInfoExtraA == null) { return(NotFound()); } return(Ok(mapInfoExtraA)); } else if (mapInfoService.Query.Extra == "B") { MapInfoExtraB mapInfoExtraB = new MapInfoExtraB(); mapInfoExtraB = mapInfoService.GetMapInfoExtraBWithMapInfoID(MapInfoID); if (mapInfoExtraB == null) { return(NotFound()); } return(Ok(mapInfoExtraB)); } else { MapInfo mapInfo = new MapInfo(); mapInfo = mapInfoService.GetMapInfoWithMapInfoID(MapInfoID); if (mapInfo == null) { return(NotFound()); } return(Ok(mapInfo)); } } }
public MapInfoTest() { mapInfo = new MapInfo(); mapInfoExtraA = new MapInfoExtraA(); mapInfoExtraB = new MapInfoExtraB(); }