public IHttpActionResult GetMikeBoundaryConditionWithID([FromUri] int MikeBoundaryConditionID, [FromUri] string lang = "en", [FromUri] string extra = "") { using (CSSPDBContext db = new CSSPDBContext(DatabaseType)) { MikeBoundaryConditionService mikeBoundaryConditionService = new MikeBoundaryConditionService(new Query() { Language = (lang == "fr" ? LanguageEnum.fr : LanguageEnum.en) }, db, ContactID); mikeBoundaryConditionService.Query = mikeBoundaryConditionService.FillQuery(typeof(MikeBoundaryCondition), lang, 0, 1, "", "", extra); if (mikeBoundaryConditionService.Query.Extra == "A") { MikeBoundaryConditionExtraA mikeBoundaryConditionExtraA = new MikeBoundaryConditionExtraA(); mikeBoundaryConditionExtraA = mikeBoundaryConditionService.GetMikeBoundaryConditionExtraAWithMikeBoundaryConditionID(MikeBoundaryConditionID); if (mikeBoundaryConditionExtraA == null) { return(NotFound()); } return(Ok(mikeBoundaryConditionExtraA)); } else if (mikeBoundaryConditionService.Query.Extra == "B") { MikeBoundaryConditionExtraB mikeBoundaryConditionExtraB = new MikeBoundaryConditionExtraB(); mikeBoundaryConditionExtraB = mikeBoundaryConditionService.GetMikeBoundaryConditionExtraBWithMikeBoundaryConditionID(MikeBoundaryConditionID); if (mikeBoundaryConditionExtraB == null) { return(NotFound()); } return(Ok(mikeBoundaryConditionExtraB)); } else { MikeBoundaryCondition mikeBoundaryCondition = new MikeBoundaryCondition(); mikeBoundaryCondition = mikeBoundaryConditionService.GetMikeBoundaryConditionWithMikeBoundaryConditionID(MikeBoundaryConditionID); if (mikeBoundaryCondition == null) { return(NotFound()); } return(Ok(mikeBoundaryCondition)); } } }
public IHttpActionResult GetMikeBoundaryConditionList([FromUri] string lang = "en", [FromUri] int skip = 0, [FromUri] int take = 200, [FromUri] string asc = "", [FromUri] string desc = "", [FromUri] string where = "", [FromUri] string extra = "") { using (CSSPDBContext db = new CSSPDBContext(DatabaseType)) { MikeBoundaryConditionService mikeBoundaryConditionService = new MikeBoundaryConditionService(new Query() { Lang = lang }, db, ContactID); if (extra == "A") // QueryString contains [extra=A] { mikeBoundaryConditionService.Query = mikeBoundaryConditionService.FillQuery(typeof(MikeBoundaryConditionExtraA), lang, skip, take, asc, desc, where, extra); if (mikeBoundaryConditionService.Query.HasErrors) { return(Ok(new List <MikeBoundaryConditionExtraA>() { new MikeBoundaryConditionExtraA() { HasErrors = mikeBoundaryConditionService.Query.HasErrors, ValidationResults = mikeBoundaryConditionService.Query.ValidationResults, }, }.ToList())); } else { return(Ok(mikeBoundaryConditionService.GetMikeBoundaryConditionExtraAList().ToList())); } } else if (extra == "B") // QueryString contains [extra=B] { mikeBoundaryConditionService.Query = mikeBoundaryConditionService.FillQuery(typeof(MikeBoundaryConditionExtraB), lang, skip, take, asc, desc, where, extra); if (mikeBoundaryConditionService.Query.HasErrors) { return(Ok(new List <MikeBoundaryConditionExtraB>() { new MikeBoundaryConditionExtraB() { HasErrors = mikeBoundaryConditionService.Query.HasErrors, ValidationResults = mikeBoundaryConditionService.Query.ValidationResults, }, }.ToList())); } else { return(Ok(mikeBoundaryConditionService.GetMikeBoundaryConditionExtraBList().ToList())); } } else // QueryString has no parameter [extra] or extra is empty { mikeBoundaryConditionService.Query = mikeBoundaryConditionService.FillQuery(typeof(MikeBoundaryCondition), lang, skip, take, asc, desc, where, extra); if (mikeBoundaryConditionService.Query.HasErrors) { return(Ok(new List <MikeBoundaryCondition>() { new MikeBoundaryCondition() { HasErrors = mikeBoundaryConditionService.Query.HasErrors, ValidationResults = mikeBoundaryConditionService.Query.ValidationResults, }, }.ToList())); } else { return(Ok(mikeBoundaryConditionService.GetMikeBoundaryConditionList().ToList())); } } } }