public IHttpActionResult GetTVItemList([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)) { TVItemService tvItemService = new TVItemService(new Query() { Lang = lang }, db, ContactID); if (extra == "A") // QueryString contains [extra=A] { tvItemService.Query = tvItemService.FillQuery(typeof(TVItemExtraA), lang, skip, take, asc, desc, where, extra); if (tvItemService.Query.HasErrors) { return(Ok(new List <TVItemExtraA>() { new TVItemExtraA() { HasErrors = tvItemService.Query.HasErrors, ValidationResults = tvItemService.Query.ValidationResults, }, }.ToList())); } else { return(Ok(tvItemService.GetTVItemExtraAList().ToList())); } } else if (extra == "B") // QueryString contains [extra=B] { tvItemService.Query = tvItemService.FillQuery(typeof(TVItemExtraB), lang, skip, take, asc, desc, where, extra); if (tvItemService.Query.HasErrors) { return(Ok(new List <TVItemExtraB>() { new TVItemExtraB() { HasErrors = tvItemService.Query.HasErrors, ValidationResults = tvItemService.Query.ValidationResults, }, }.ToList())); } else { return(Ok(tvItemService.GetTVItemExtraBList().ToList())); } } else // QueryString has no parameter [extra] or extra is empty { tvItemService.Query = tvItemService.FillQuery(typeof(TVItem), lang, skip, take, asc, desc, where, extra); if (tvItemService.Query.HasErrors) { return(Ok(new List <TVItem>() { new TVItem() { HasErrors = tvItemService.Query.HasErrors, ValidationResults = tvItemService.Query.ValidationResults, }, }.ToList())); } else { return(Ok(tvItemService.GetTVItemList().ToList())); } } } }