public IHttpActionResult GetHydrometricDataValueWithID([FromUri] int HydrometricDataValueID, [FromUri] string lang = "en", [FromUri] string extra = "") { using (CSSPDBContext db = new CSSPDBContext(DatabaseType)) { HydrometricDataValueService hydrometricDataValueService = new HydrometricDataValueService(new Query() { Language = (lang == "fr" ? LanguageEnum.fr : LanguageEnum.en) }, db, ContactID); hydrometricDataValueService.Query = hydrometricDataValueService.FillQuery(typeof(HydrometricDataValue), lang, 0, 1, "", "", extra); if (hydrometricDataValueService.Query.Extra == "A") { HydrometricDataValueExtraA hydrometricDataValueExtraA = new HydrometricDataValueExtraA(); hydrometricDataValueExtraA = hydrometricDataValueService.GetHydrometricDataValueExtraAWithHydrometricDataValueID(HydrometricDataValueID); if (hydrometricDataValueExtraA == null) { return(NotFound()); } return(Ok(hydrometricDataValueExtraA)); } else if (hydrometricDataValueService.Query.Extra == "B") { HydrometricDataValueExtraB hydrometricDataValueExtraB = new HydrometricDataValueExtraB(); hydrometricDataValueExtraB = hydrometricDataValueService.GetHydrometricDataValueExtraBWithHydrometricDataValueID(HydrometricDataValueID); if (hydrometricDataValueExtraB == null) { return(NotFound()); } return(Ok(hydrometricDataValueExtraB)); } else { HydrometricDataValue hydrometricDataValue = new HydrometricDataValue(); hydrometricDataValue = hydrometricDataValueService.GetHydrometricDataValueWithHydrometricDataValueID(HydrometricDataValueID); if (hydrometricDataValue == null) { return(NotFound()); } return(Ok(hydrometricDataValue)); } } }
public HydrometricDataValueTest() { hydrometricDataValue = new HydrometricDataValue(); hydrometricDataValueExtraA = new HydrometricDataValueExtraA(); hydrometricDataValueExtraB = new HydrometricDataValueExtraB(); }