public IHttpActionResult GetMWQMSiteStartEndDateWithID([FromUri] int MWQMSiteStartEndDateID, [FromUri] string lang = "en", [FromUri] string extra = "")
        {
            using (CSSPDBContext db = new CSSPDBContext(DatabaseType))
            {
                MWQMSiteStartEndDateService mwqmSiteStartEndDateService = new MWQMSiteStartEndDateService(new Query()
                {
                    Language = (lang == "fr" ? LanguageEnum.fr : LanguageEnum.en)
                }, db, ContactID);

                mwqmSiteStartEndDateService.Query = mwqmSiteStartEndDateService.FillQuery(typeof(MWQMSiteStartEndDate), lang, 0, 1, "", "", extra);

                if (mwqmSiteStartEndDateService.Query.Extra == "A")
                {
                    MWQMSiteStartEndDateExtraA mwqmSiteStartEndDateExtraA = new MWQMSiteStartEndDateExtraA();
                    mwqmSiteStartEndDateExtraA = mwqmSiteStartEndDateService.GetMWQMSiteStartEndDateExtraAWithMWQMSiteStartEndDateID(MWQMSiteStartEndDateID);

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

                    return(Ok(mwqmSiteStartEndDateExtraA));
                }
                else if (mwqmSiteStartEndDateService.Query.Extra == "B")
                {
                    MWQMSiteStartEndDateExtraB mwqmSiteStartEndDateExtraB = new MWQMSiteStartEndDateExtraB();
                    mwqmSiteStartEndDateExtraB = mwqmSiteStartEndDateService.GetMWQMSiteStartEndDateExtraBWithMWQMSiteStartEndDateID(MWQMSiteStartEndDateID);

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

                    return(Ok(mwqmSiteStartEndDateExtraB));
                }
                else
                {
                    MWQMSiteStartEndDate mwqmSiteStartEndDate = new MWQMSiteStartEndDate();
                    mwqmSiteStartEndDate = mwqmSiteStartEndDateService.GetMWQMSiteStartEndDateWithMWQMSiteStartEndDateID(MWQMSiteStartEndDateID);

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

                    return(Ok(mwqmSiteStartEndDate));
                }
            }
        }
        public void GetMWQMSiteStartEndDateList_2Where_Test()
        {
            foreach (CultureInfo culture in AllowableCulture)
            {
                ChangeCulture(culture);

                using (CSSPDBContext dbTestDB = new CSSPDBContext(DatabaseTypeEnum.SqlServerTestDB))
                {
                    foreach (string extra in new List <string>()
                    {
                        null, "A", "B", "C", "D", "E"
                    })
                    {
                        MWQMSiteStartEndDateService mwqmSiteStartEndDateService = new MWQMSiteStartEndDateService(new Query()
                        {
                            Lang = culture.TwoLetterISOLanguageName
                        }, dbTestDB, ContactID);

                        mwqmSiteStartEndDateService.Query = mwqmSiteStartEndDateService.FillQuery(typeof(MWQMSiteStartEndDate), culture.TwoLetterISOLanguageName, 0, 10000, "", "", "MWQMSiteStartEndDateID,GT,2|MWQMSiteStartEndDateID,LT,5", extra);

                        List <MWQMSiteStartEndDate> mwqmSiteStartEndDateDirectQueryList = new List <MWQMSiteStartEndDate>();
                        mwqmSiteStartEndDateDirectQueryList = (from c in dbTestDB.MWQMSiteStartEndDates select c).Where(c => c.MWQMSiteStartEndDateID > 2 && c.MWQMSiteStartEndDateID < 5).ToList();

                        if (string.IsNullOrWhiteSpace(extra))
                        {
                            List <MWQMSiteStartEndDate> mwqmSiteStartEndDateList = new List <MWQMSiteStartEndDate>();
                            mwqmSiteStartEndDateList = mwqmSiteStartEndDateService.GetMWQMSiteStartEndDateList().ToList();
                            CheckMWQMSiteStartEndDateFields(mwqmSiteStartEndDateList);
                            Assert.AreEqual(mwqmSiteStartEndDateDirectQueryList[0].MWQMSiteStartEndDateID, mwqmSiteStartEndDateList[0].MWQMSiteStartEndDateID);
                        }
                        else
                        {
                            //Assert.AreEqual(true, false);
                        }
                    }
                }
            }
        }
        public IHttpActionResult GetMWQMSiteStartEndDateList([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))
            {
                MWQMSiteStartEndDateService mwqmSiteStartEndDateService = new MWQMSiteStartEndDateService(new Query()
                {
                    Lang = lang
                }, db, ContactID);

                if (extra == "A") // QueryString contains [extra=A]
                {
                    mwqmSiteStartEndDateService.Query = mwqmSiteStartEndDateService.FillQuery(typeof(MWQMSiteStartEndDateExtraA), lang, skip, take, asc, desc, where, extra);

                    if (mwqmSiteStartEndDateService.Query.HasErrors)
                    {
                        return(Ok(new List <MWQMSiteStartEndDateExtraA>()
                        {
                            new MWQMSiteStartEndDateExtraA()
                            {
                                HasErrors = mwqmSiteStartEndDateService.Query.HasErrors,
                                ValidationResults = mwqmSiteStartEndDateService.Query.ValidationResults,
                            },
                        }.ToList()));
                    }
                    else
                    {
                        return(Ok(mwqmSiteStartEndDateService.GetMWQMSiteStartEndDateExtraAList().ToList()));
                    }
                }
                else if (extra == "B") // QueryString contains [extra=B]
                {
                    mwqmSiteStartEndDateService.Query = mwqmSiteStartEndDateService.FillQuery(typeof(MWQMSiteStartEndDateExtraB), lang, skip, take, asc, desc, where, extra);

                    if (mwqmSiteStartEndDateService.Query.HasErrors)
                    {
                        return(Ok(new List <MWQMSiteStartEndDateExtraB>()
                        {
                            new MWQMSiteStartEndDateExtraB()
                            {
                                HasErrors = mwqmSiteStartEndDateService.Query.HasErrors,
                                ValidationResults = mwqmSiteStartEndDateService.Query.ValidationResults,
                            },
                        }.ToList()));
                    }
                    else
                    {
                        return(Ok(mwqmSiteStartEndDateService.GetMWQMSiteStartEndDateExtraBList().ToList()));
                    }
                }
                else // QueryString has no parameter [extra] or extra is empty
                {
                    mwqmSiteStartEndDateService.Query = mwqmSiteStartEndDateService.FillQuery(typeof(MWQMSiteStartEndDate), lang, skip, take, asc, desc, where, extra);

                    if (mwqmSiteStartEndDateService.Query.HasErrors)
                    {
                        return(Ok(new List <MWQMSiteStartEndDate>()
                        {
                            new MWQMSiteStartEndDate()
                            {
                                HasErrors = mwqmSiteStartEndDateService.Query.HasErrors,
                                ValidationResults = mwqmSiteStartEndDateService.Query.ValidationResults,
                            },
                        }.ToList()));
                    }
                    else
                    {
                        return(Ok(mwqmSiteStartEndDateService.GetMWQMSiteStartEndDateList().ToList()));
                    }
                }
            }
        }