public IHttpActionResult GetMapInfoPointWithID([FromUri] int MapInfoPointID, [FromUri] string lang = "en", [FromUri] string extra = "")
        {
            using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
            {
                MapInfoPointService mapInfoPointService = new MapInfoPointService(new Query()
                {
                    Language = (lang == "fr" ? LanguageEnum.fr : LanguageEnum.en)
                }, db, ContactID);

                mapInfoPointService.Query = mapInfoPointService.FillQuery(typeof(MapInfoPoint), lang, 0, 1, "", "", extra);

                if (mapInfoPointService.Query.Extra == "A")
                {
                    MapInfoPointExtraA mapInfoPointExtraA = new MapInfoPointExtraA();
                    mapInfoPointExtraA = mapInfoPointService.GetMapInfoPointExtraAWithMapInfoPointID(MapInfoPointID);

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

                    return(Ok(mapInfoPointExtraA));
                }
                else if (mapInfoPointService.Query.Extra == "B")
                {
                    MapInfoPointExtraB mapInfoPointExtraB = new MapInfoPointExtraB();
                    mapInfoPointExtraB = mapInfoPointService.GetMapInfoPointExtraBWithMapInfoPointID(MapInfoPointID);

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

                    return(Ok(mapInfoPointExtraB));
                }
                else
                {
                    MapInfoPoint mapInfoPoint = new MapInfoPoint();
                    mapInfoPoint = mapInfoPointService.GetMapInfoPointWithMapInfoPointID(MapInfoPointID);

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

                    return(Ok(mapInfoPoint));
                }
            }
        }
Ejemplo n.º 2
0
 public MapInfoPointTest()
 {
     mapInfoPoint       = new MapInfoPoint();
     mapInfoPointExtraA = new MapInfoPointExtraA();
     mapInfoPointExtraB = new MapInfoPointExtraB();
 }